Understanding Meta-HTML

PeopleSoft page processing includes functionality to perform certain substitutions in the generated HTML. These substitutions are known as meta-HTML. These meta-HTML elements enable access to some of the runtime environment, and in some cases, to perform browser-dependent substitutions.

The meta-HTML processing is performed on the entire page, including the contents of any HTML areas in the page. Meta-HTML can be used in the following items:

  • An HTML area of a page definition.

  • iScript output – An iScript can generate HTML, which could also contain JavaScript code.

  • HTML layout objects – That is, HTML objects used for homepage tab or pagelet layout.

  • Style sheet definitions – Typically, free form style sheets. These are attached as an “auxiliary file” with a .css extension.

  • JavaScript definitions – That is, an HTML definition that consists of JavaScript code. These are attached as an “auxiliary file” with a .js extension.

A limited subset of the meta-HTML processing is performed on any auxiliary JavaScript or style sheet files attached and downloaded to the web server. Each meta-HTML element that may be used in auxiliary files is noted in its description. This meta-HTML processing occurs both for files attached to PeopleSoft pages and for files attached to iScript output:

  • Attaching JavaScript as an auxiliary file:

    • Use the %JavaScript meta-HTML function to attach JavaScript as an auxiliary file to an HTML area. See %JavaScript.

    • Use the GetJavaScriptURL method of the Response class to attach JavaScript as an auxiliary file to iScript output or a PeopleSoft page. See GetJavaScriptURL.

  • Attaching a style sheet as an auxiliary file:

    • Use the %StyleSheet meta-HTML function to attach a style sheet as an auxiliary file to an HTML area. See %StyleSheet.

    • Use the GetStyleSheetURL method of the Response class to attach a style sheet as an auxiliary file to iScript output or a PeopleSoft page. See GetStyleSheetURL.

A meta-HTML variable has the form %name, similar to the PeopleCode system variables. It's replaced by the substituted value wherever it appears. The following example shows the use of meta-HTML variables:

&html = "<html dir='" | %Direction | "' lang='" | %LanguageISO | "'>";

A meta-HTML function has the following form:

%name(parameter, parameter...) 

The entire expression is replaced by a substituted value, where the parameters are used in determining the value to be substituted. The parameters are arbitrary sequences of characters separated by commas. Do not place quotes around the parameters unless they form part of the value to be used.

In the following example, the entire text is replaced by the contents of the message 126, 45 from the message catalog, or the phrase "Unable to load images" if that message isn't found.

%Message(126, 45, Unable to load images)

The meta-HTML processor recognizes two forms of comments. These comments are deleted from the generated HTML or JavaScript. They enable the application developer to comment the HTML objects in the database without increasing the size of the HTML passed to the browser.

The recognized comments are as follows:

Two slashes followed by a percent sign at the start of a line designates everything to the end of the line containing the slashes as a comment.

//%  anything

A less-than sign, followed by an exclamation mark and a percentage sign designates everything from those marks to the mark --> as a comment, which may be on another line.

<!%  anything   --> 

These meta-HTML comments may be used both in HTML areas and attached auxiliary files.

When you specify a definition name in an HTML area, it is not found using the Find Definition References menu item in Application Designer. It also won't be automatically renamed when a definition is renamed. All text within an HTML area is treated like a quoted string, a literal.

For example, Find Definition References won't find references to the PSLOGO image or the PT_EDITSCRIPTS HTML definition .

<img src='%Image(PSLOGO)'> 

<script src='%JavaScript(PT_EDITSCRIPTS)'></script>