HomeOracle Page 3 - Working with Themes and Templates
Templates - Oracle
Most experienced programmers understand the advantages of separating the look and feel of an application from the application's logic. Oracle uses HTML DB to accomplish this. This article introduces you to the themes and templates that HTML DB provides. It is excerpted from chapter 6 of the Oracle HTML DB Handbook, written by Lawrence Linnemeyer and Bradley Brown (McGraw-Hill, 2006; ISBN: 0072257687).
HTML DB uses templates to control the look and feel of an application. Templates are made up of HTML code and substitution variables. At run time, the HTML DB engine uses information from your object definitions to dynamically fill in information for the substitution variables and create the final HTML pages. The large number of template types available allows you to precisely control the way your application looks while centralizing the administration of the look and feel.
HTML DB has nine different types of templates, as listed in the introduction of this chapter. The templates apply to all different types of objects. Objects that use templates go from more general type objects, like pages and regions, to more specific type objects, like lists and buttons.
Page templates control the look and feel of common items on a page, such as headers, footers, parent tabs, standard tabs, and navigation bars. As shown in Figure 6-3, a typical application needs three different page templates: Page, Error Page, and Printer Friendly Page. Although it is possible to use only one page template for an entire application, a more professional look and feel can be accomplished with a variety of templates.
Region templates control the look and feel of regions within a page. They control items such as region borders, titles, and the placement of buttons.
Report templates format the results of a database query. They control the look of headers and rows. Conditional row formatting can be used to dynamically change the look of a row based on the row’s content and whether it is an odd or even row.
List templates control the look and feel of a shared group of links. You can control before and after list formatting as well as current and noncurrent link formatting.
Label templates control the look and feel of item labels. Typically label templates are used to distinguish between required and nonrequired fields.
Calendar templates control the look and feel as well as the placement of a calendar. They are typically made from an HTML table to control the placement of dates.
Menu templates control the look and feel of menus. Menu templates are selected for creating a menu-type region.
Button templates are used to control the appearance of buttons. Buttons can be created using multiple images or with HTML. The use of templates is optional for buttons.
Popup LOV Templates
Popup LOV templates are used to control the look and feel of items of type POPUP. Only one Popup LOV template can be specified for an application; therefore, it is the only template type for which a developer does not specify a default.
Templates are managed from the Templates page. To get to the Templates page, click on the magnifying glass icon in the View column on the Themes page. The Templates page allows you to see all templates for all themes within your application. The selection boxes at the top of the page, as shown in Figure 6-4, allow you to limit the templates displayed by selecting a theme, a template type, and whether the template is referenced in your application. This page tells you a lot about your templates, such as which ones are the defaults, how many references there are to a template, and whether the template is subscribed to a master template. From this page, you can also create a new template, edit any existing template, and even do a mass replacement of templates from another application.