12.1 Understanding Templates in Oracle Portal

A template is a tool for enforcing a standard layout and look and feel across multiple pages or within a region. When you change a template, all pages or regions that are based on that template are automatically changed as well. Templates provide additional standardization controls, depending on the type you use.

In Oracle Portal, you can create two types of templates:

  • Portal Templates

  • HTML Templates

These are described later in this chapter.

Templates can be used only within their page group, except for those contained in the Shared Objects page group. Templates in the Shared Objects page group can be applied across page groups.

Note:

The default language of the Shared Objects page group is English. This can have implications particularly when you want to share a template over non-English page groups. Objects on a template in the Shared Objects page group that do not have an explicit translation in the relevant language will not display on the non-English pages that are based on the template. If you want those objects to display, first you must add translated versions of those objects to the template. For information on adding item translations, see Section 19.3.1, "Adding a Translated Item".

This section provides descriptions of these template types and lists the conditions governing their use. It includes the following subsections:

12.1.1 What Are Portal Templates?

Portal Templates are templates you build declaratively by stepping through a template-building wizard. You can use Portal Templates to enforce specific layouts, colors, fonts, and backgrounds. You can extend Portal Templates using page parameters and events.

You can use Portal Templates in two ways: with pages and with items. This section provides a high-level overview of the benefits and uses of Portal Templates and a more detailed discussion of Portal Templates for pages and Portal Templates for items. It includes the following subsections:

12.1.1.1 Portal Template Uses and Benefits

Portal Templates provide a simple, declarative means of defining templates to apply to pages and items. Use Portal Templates for pages on navigation pages, standard pages, and custom pages that are based on the standard page type. Use Portal Templates for items with Text items, PL/SQL items, URL items, and all File items of the type text/html or text/plain.

Portal Templates for pages enforce a standard appearance and page layout. Portal Templates for items display item content within the context of a template and, working in concert with parameters, show template portlets in a master/detail relationship with the item currently displayed.

Portal Templates for items use the Item Placeholder item type to stand in for item content. Users access an item's URL, and the item renders within the context of the template, in the location formerly held by the Item Placeholder. Portal Templates for items can be applied at either the page or item level (see Section 12.2.2, "Using Portal Templates with Items".

12.1.1.2 Portal Templates for Pages

You can use Portal Templates for pages to enforce a particular layout, style, set of privileges, and content across multiple pages. As with a standard page, you can divide a Portal Template for pages into regions and tabs, apply a style to the template, grant access privileges, and add items and portlets. Additionally, you can define parameters for the template and use them in conjunction with the portlets placed on the pages that are based on the template.

Figure 12-2 Portal Templates for Pages

Portal templates for pages
Description of "Figure 12-2 Portal Templates for Pages"

Any page that uses the template includes all the items, portlets, privileges, and parameters included in the template. An update to the template results in an instant and automatic update to all pages that are based on the template.

Template builders have the option of allowing template users to specify their own access rules or select their own styles. When templates allow users to select their own access rules or styles, updates to these properties on the template do not affect the pages that are based on the template.

For information on creating, applying, editing, or detaching a Portal Template for pages, see Section 12.2, "Working with Portal Templates for Pages and Items".

12.1.1.3 Portal Templates for Items

You can use Portal Templates for items to enforce a particular layout, style, and associated content. With Portal Templates for items, a requested item displays within the layout defined by the template rather than in place on the item's container page. For example, when a link to an item displays on the item's container page, users click the link, and the item content displays within the context of its associated Portal Template. The item's content is displayed in place of the item placeholder on the template (Figure 12-3).

Figure 12-3 Portal Templates for Items

Portal templates for items
Description of "Figure 12-3 Portal Templates for Items"

You can use Portal Templates for items with Text items, PL/SQL items, URL items, and all File items of the type text/html or text/plain.

Portal Templates for items are built with the same wizard that is used for creating Portal Templates for pages. The main difference between these template types is that templates for items are used in conjunction with the Item Placeholder item type, while templates for pages are not. Once an item placeholder is added to a Portal Template, the Portal Template becomes a Portal Template for items and is available for use only with items. Another difference is the security model that applies to each template type. For more information, see Section 17.11, "Granting Privileges on Portal Templates".

When an item is requested through its URL, Portal Templates for items dynamically place the requested item's content where the item placeholder is located on the template. Portal Templates for items cannot be used as page templates. Once the item placeholder is added to a Portal Template, the template no longer displays on any template pick lists used to apply templates to pages.

The item placeholder reserves a position within the template layout. As items are requested, that position is filled with their content. You can select a default item to temporarily stand in for the content that will populate the reserved position. You may wish to select a default item for the item placeholder to ensure that relevant content is seen if the Portal Template for items is called directly, through its URL.

Users switching between tabs on a page assembled from a Portal Template for items may lose the context of the originally-requested item. In such cases, users are likely to see the default (placeholder) item in lieu of the item that originally invoked the template. One way to circumvent confusing, though logical, situations like this is to keep item templates as simple as possible, with minimal in-page navigation, such as with few if any tabs and sub-tabs.

You can define parameters in a Portal Template for items and use them to communicate with any portlets that are included on the template.

You can apply access controls to Portal Templates for items that secure the entire template, template tabs, and template items. For more information, see Section 17.11, "Granting Privileges on Portal Templates"

For information on creating, applying, editing, or detaching a Portal Template for items, see Section 12.2.2, "Using Portal Templates with Items".

12.1.2 What Are HTML Templates?

HTML Templates are templates you build using your own HTML code. You can build HTML to wrap around page content or to format region content. Create HTML Templates using a simple Oracle Portal wizard.

Any valid HTML code can be placed in an HTML template. This includes JavaScript, Macromedia Flash, and the like. Additionally Oracle Portal provides HTML template substitution tags, which you can use to include Oracle Portal content in the template. For more information on HTML substitution tags, see Appendix E, "Substitution Tags for HTML and Unstructured UI Templates".

HTML Templates include two subtypes: HTML Page Skins and HTML Content Layouts. This section describes these template types and explores their potential uses. It includes the following subsections:

12.1.2.1 HTML Template Uses and Benefits

HTML templates give you more control over HTML for your pages. Use them for page and page portlet decoration, for wrapping pages and page portlets in HTML or any other standard Web mark-up, and for laying out and formatting item links in concert with their item attributes.

HTML page skins render around the outside borders of a page. They can be applied to both pages and Portal Templates. For example, you can apply an HTML page skin to a Portal Template, then apply the Portal Template to a page. Because pages allow the application of only one page-level template, applying an HTML page skin to a Portal Template, then applying the Portal Template to a page is a way to enable a page to use an HTML page skin and a Portal Template at the same time.

The page skins you apply to a page also display when the page is exposed as a portlet. The template wraps around the portlet, giving the appearance of a region skin. You can use an HTML content layout template to achieve the same effect.

Page skins use page-level substitution tags to stand in for standard page elements, such as the page title, the currently logged in user, seeded site links, and the like. Substitution tags generate the HTML to render information stored in the Portal Repository. Additionally, you can use <oracle></oracle> tags to introduce PL/SQL elements, such as conditional statements, into your template. For more information on HTML page skin substitution tags, see Appendix E, "Substitution Tags for HTML and Unstructured UI Templates".

At the region level, choose between selecting specific attributes for display and rendering region content with an HTML content layout template. With HTML content layouts, the HTML you create repeats for every item in a region. For example, create an HTML content layout with a two-column structure, that exposes item content (in the form of a link to the item) in one column and its Create Date, Description, and Author attributes in the other column. Enter the HTML for this once in the HTML content layout template. Apply the template to a region with three items. All three items display according to the template's HTML (Figure 12-4).

Figure 12-4 Region with an HTML Content Layout

Region with an HTML content layout
Description of "Figure 12-4 Region with an HTML Content Layout"

HTML content layouts use item-level substitution tags for label, value, and style, allowing you full control of your HTML. Additionally, with HTML content layouts you can use <oracle></oracle> tags to introduce PL/SQL elements, such as conditional statements, into your template.

Note:

HTML content layouts apply only to content item types, not to navigation item types. For example, the HTML content layout selected for a region will be applied to text items in the region, but not to list of objects items.

12.1.2.2 HTML Page Skins

Use HTML page skins to define the appearance of the area surrounding page content. You can use HTML tables to make the page skin display content on all four sides of the page. You can add images, text, HTML formatting, JavaScript, and any other typical mark up or object type you could place on any other Web page.

Figure 12-5 HTML Page Skin

HTML page skin
Description of "Figure 12-5 HTML Page Skin"

With HTML page skins, you define where the body area of the page will be. The body area is where page content will display.

You can introduce Oracle Portal elements into your page skin through the use of HTML page skin substitution tags. Use these to introduce such elements as page Edit or Personalize links, the name of the currently logged-in user, the current page's display name, and so on. For a list of HTML page skin substitution tags, including descriptions and examples, see Appendix E, "Substitution Tags for HTML and Unstructured UI Templates".

You can also use <oracle></oracle> tags to introduce PL/SQL elements, such as conditional statements, into your template.

Create an HTML page skin using an Oracle Portal wizard. You can use a third-party HTML editor to create the template HTML, then simply cut and paste your result into the wizard's HTML code field.

For information about creating, applying, editing, or detaching an HTML page skin, see Section 12.3.1, "Using HTML to Define a Page Border".

12.1.2.3 HTML Content Layouts

Use HTML content layouts to define a formatting scheme for content within a particular region. Design HTML content layouts for use with item regions, portlet regions, or both. Use HTML to create tables, font designs, colors, and any other mark up or object type you could place in any other HTML template. You can even call a cascading style sheet (CSS) to apply a standard format that you use in other forms of company documentation.

Note:

The HTML content layout repeats itself for each portlet or item in the region. Consider carefully before using a CSS in the content layout. The CSS is repeated as many times as the number of items in the region.

For additional information on Oracle Portal and cascading style sheets, see Section 11.12, "Using Portal Style Element Classes in HTML Templates and CSSs".

Figure 12-6 HTML Content Layout

HTML content layout
Description of "Figure 12-6 HTML Content Layout"

Use HTML content layout substitution tags to introduce Oracle Portal elements, such as display names, descriptions, categories, perspectives, and so on. For a list of HTML content layout substitution tags, including descriptions and examples, see Appendix E, "Substitution Tags for HTML and Unstructured UI Templates".

You can also use <oracle></oracle> tags to introduce PL/SQL elements, such as conditional statements, into your template.

Create your HTML content layout using the Oracle Portal wizard. You can use a third-party HTML editor to create the template HTML, then simply cut and paste your result into the wizard's HTML code field.

For information on creating, applying, editing, or detaching an HTML content layout, see Section 12.3.2, "Using HTML to Define the Layout and Appearance of Region Content".

12.1.3 Comparing Template Types

Table 12-1 provides a concise description of where in the Oracle Portal user interface you can apply each type of template and a brief summary of the conditions governing the use of each type.

Table 12-1 Comparison of Template Types

Type Where to Apply Conditions Governing Use

Portal Templates for Pages

  • Select a default template for the page group on the Configure tab of page group properties.

  • Select a template for a page on the Template tab of page properties.

The default template you select at the page group level is applied to sub-pages in the page group only if page designers do not explicitly select a template when they create pages. Additionally, the page group setting Use Default Properties When Creating Page (on the Configure tab of page group properties, under Page Defaults) must be selected. If it is not selected, sub-pages inherit whatever template is specified for the parent page's page properties, rather than from page group properties).

Use Portal Templates for pages on navigation pages, standard pages, or custom page types that are based on the standard page type.

Portal Templates for Items

Select a Portal Template for items on the Items tab of page properties (but see Conditions Governing Use).

  • For this feature to be available, a Portal Template for items must be defined for the page group that owns the current page or for the Shared Objects page group.

  • For the template to be a Portal Template for items, it must contain an item placeholder-type item.

  • Default content for the item placeholder can be a file or a text item type. Files can contain either text or HTML.

HTML Page Skins

  • Select a default template for the page group on the Configure tab of page group properties.

  • Select an HTML Page Skin for a page on the Template tab of page properties

The option to use a page skin is selectable on a page's Template tab only when at least one page skin is defined in the page group or the Shared Objects page group.

HTML Content Layouts

To select an HTML Content Layout:

  1. Edit a portlet or item region.

  2. Go to the Attributes tab.

  3. Select the Use HTML Content Layout radio button.

  4. Select a content layout template.

The option to use a content layout is selectable on the Attributes tab only when at least one content layout is defined in the page group or the Shared Objects page group.


Note:

When a page group and the Shared Objects page group both have a template of the same name, the page group name is added to the template name in pick lists. For example: <template_name> (page_group_name). This assists in distinguishing between templates on pick lists.