HomeOracle Page 3 - Focusing on Templates in Oracle HTML DB
Header/Body/Footer Definitions - Oracle
In this second part of a three-part article covering Oracle HTML DB, you'll learn about common template sections and more. This article is excerpted from the Oracle HTML DB Handbook, written by Lawrence Linnemeyer and Bradley Brown (McGraw-Hill, 2006; ISBN: 0072257687).
The next section contains the definitions for the header, the body, and the footer of the page. Remember, the HTML DB engine generates each page at run time by combining the static HTML defined in your template with the dynamic pieces derived from the metadata you used when building the pages. This connection is made through the use of substitution variables. There is an area for entering the HTML for the Header section, the Body section, and the Footer section. Let’s take a closer look at an example of each of these definitions.
Header
The Header section contains the HTML for the HEAD section of an HTML document. Everything you would normally include before the BODY tag in an HTML document belongs here. Someone familiar with web page layout and HTML should make the modifications to templates. However, if you must do it and are not familiar with HTML, then try HTML & XHTML: The Complete Reference by Thomas Powell (McGraw-Hill/Osborne, 2003).
The following is a listing of code from the header definition:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>#TITLE#</title> #HEAD# <link rel="stylesheet" href="#IMAGE_PREFIX#css/einstein.css" type="text/css" /> <script src="#IMAGE_PREFIX#javascript/functions.js" type="text/javascript"></script> </head>
Notice the example contains normal HTML items such as the title tag and includes statements for a Cascading Style Sheet and a file containing JavaScript. It also contains several substitution variables.
The substitution variable #TITLE# will be replaced at run time with the value from the Title field in the Primary Page Attributes section of the Edit page, or “Form on CONTACTS,” as shown in Figure 6-7. The substitution variable #HEAD# will be replaced with the value entered in the HTML Header section of the Edit page, as shown in Figure 6-7. You might have HTML to reference additional JavaScript libraries or Cascading Style Sheets.
The other substitution variable seen in this code block is #IMAGE_PREFIX#. This is a predefined variable that contains the directory on the server for the images that come with HTML DB. If you look at the source of a generated page, you will see that it resolves to /i/, which is mapped to ORACLE_HOME\marvel\images. The Cascading Style Sheet (CSS) file is located in ORACLE_HOME\ marvel\images\css, and the JavaScript file is located in ORACLE_HOME\marvel\images\ javascript. At a minimum, the Header section should contain the #TITLE# and the
Figure 6-7. Edit page--source for substitution variables
#HEAD# substitution variables. Here’s a list of the other substitution variables allowed in the Header section: