HomeOracle Page 4 - Working with Themes and Templates
Editing an Existing Template - 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).
To edit any existing template, simply click on the template name from the Templates page. This will take you to a type-specific template edit page. In order to edit templates, you need at least a good working knowledge of HTML. See the following sections for specifics on Page and Report templates. Due to space limitation, we are not able go into complete detail on all nine different types of templates. However, you will come to find that they are very similar when it comes to editing them. With a good working knowledge of HTML, an understanding of the substitution variables, and some hands-on experimentation, you should be able to fully understand each type of template.
Figure 6-4.Templates page
Creating and Copying Templates
Like themes, templates can either be created from scratch or copied from another location. With templates, you don’t copy from the HTML DB repository, but rather from other templates in other themes, including themes from other applications. Like with themes, template creation is accomplished through a multiscreen wizard. The first screen allows you to select the type of template you are going to create. On the next screen you choose to create the template either from scratch or as a copy of an existing template.
If you choose to create the template from scratch, you will be asked to name the template, select the theme it will belong to, and specify the template class. Upon confirmation, a nearly blank template will be created; it will include some very basic HTML along with the minimal substitution variables.
If you go the route of creating a template as a copy of an existing template, you select the application to copy from and then select the theme to copy from and the theme to copy to. At this point, the wizard will present to you a list of templates from the selected theme that are of the type you chose to copy, as shown in Figure 6-5. For each of the templates listed, you can choose to copy and subscribe, just copy, or not copy. If you subscribe to a template and changes are later made to the master template, you can update the subscribed template by entering the edit template page and clicking on the Refresh Template button found in the Template Subscription section of the edit template page. Be aware that any changes you make to the subscribing template will be lost when you refresh the template.
Figure 6-5.Creating templates by copying
Figure 6-6. Replacing templates
There is one other powerful feature available for copying templates. If you have copied templates from another application but did not subscribe when you copied, you can still refresh the template from the original. Actually, you can replace any utilized template in your current application with another template in another application. In the Tasks box on the right side of the Templates page is an option titled “Replace templates in this application with templates from another application.” If you follow this link, you will be asked to select the source application from which you would like to replace templates. You will then be presented with a list of the templates for your current application that are currently being utilized. For each of these templates, you can choose a replacement and select whether to replace or to replace and subscribe, as shown in Figure 6-6.
Please check back next week for the continuation of this article.