HomeOracle Page 2 - Sub-templates and More with Oracle HTML DB
Sub-template Definitions - Oracle
In this third part of a three-part article covering Oracle HTML DB, you'll learn about sub-template definitions and more. This article is excerpted from the Oracle HTML DB Handbook, written by Lawrence Linnemeyer and Bradley Brown (McGraw-Hill, 2006; ISBN: 0072257687).
Some templates contain sub-templates. A sub-template is a portion of a template that is defined in the later part of the template definition page and referred to in an earlier section of the template with a substitution variable.
This sub template will be the value for the #SUCCESS_MESSAGE# substitution variable used in the Body section. This sub-template is where you specify the HTML for formatting the content of the success message. This sub-template also uses the #SUCCESS_MESSAGE# substitution variable. This could be a little confusing because the same substitution variable is used for two different things. When it is used here, it is substituted with the actual text of a success message after a page is processed successfully; when it is used in the Body section, it is substituted with the value of this sub-template. The light bulb and “Action Processed” text seen in Figure 6-8 are the results of the following code:
This sub-template is the source for the value of the substitution variable #NAVIGATION_BAR# used in the Body section. This is where you format the navigation bar specified in the Shared Components section of an application. Two items—Help and Logout—were defined for the navigation bar shown in Figure 6-8. The following listing of code is used to display the example’s navigation bar. The substitution variable #BAR_BODY# is used to place the actual contents of the navigation bar. The contents of this substitution variable can be controlled even further if desired. See the upcoming “Navigation Bar Entry” section for more details.
If you want extreme control of the way the items in the navigation bar are displayed, this is the section where that is accomplished. Note that it is not necessary to define this sub-template; the items in a navigation bar will display fine without any entry here. The code entered here controls the presentation of each individual navigation item placed in the navigation bar’s #BAR_BODY#. You can use eight different substitution variables in creating this sub-template. They can all be found in the help for the section by clicking on the title of the section. The following code listing uses two of the substitution variables. The first, #LINK#, will receive the actual URL link of the navigation item. The second, #TEXT#, will receive the text of the navigation item.
This sub-template defines the value for the #NOTIFICATION_MESSAGE# substitution variable used in the header. The only substitution variable available for this section is the #MESSAGE# variable. Include this variable in any HTML code you would like to use to format the notification message. This section is very similar to the “Success Message” section, earlier in this chapter.