34 Classic HTML Conversion Layout Templates

This chapter provides information about creating and using classic HTML conversion layout templates.

This chapter covers the following topics:

34.1 About Classic HTML Conversion Layout Templates

Layout templates can be used to complement Classic HTML Conversion templates (see Chapter 33). They can be used to control the placement of items on a web page, in particular, the areas outside of the converted document. You can add shared borders, navigation, custom scripting, and much more in your layout template. You might use the layout template to create a common set of hyperlinks around your converted documents (such as "additional resources"), or you might prefer to maintain the Oracle WebCenter Content Server look and feel around your documents using Idoc Script header and footer tags.

If you do not specify a layout template on the Template Selection Rules page, your converted document will take up the entire web browser screen area when a user clicks the (HTML) link in the Content Server interface (see Section 37.2).

Figure 34-1 Converted Document without Layout Template

A converted document without a layout template

If you specify a layout template, such as the default_layout.txt sample, you can add a consistent look and feel around your content items.

Figure 34-2 Converted Document with Layout Template

A converted document using a layout template

34.2 Layout Template Contents

A typical layout template contains the following parts:

  • HTML top and head information

  • HTML tables (used to control page layout)

  • Tokens for your template settings (see Section 34.3)

  • Idoc Script code (for various purposes)

When used together, you will find that you can fine tune the appearance of your converted documents on a global level, giving your online information a professional and consistent look and feel.

34.3 Tokens in Layout Templates

Tokens are placeholders or variables for the Classic HTML Conversion template settings that you create in the Template Editor. A layout template is used to control the placement of items around your converted content. If you wanted to include a particular TOP or HEAD setting from your Classic HTML Conversion template (keep in mind that layout templates are frequently used with Classic HTML Conversion templates), this would normally require you to copy and paste the information into your layout template (in the TOP or HEAD HTML tag). With a token, you can reserve that space for a Classic HTML Conversion template setting.

There are four tokens available:

  • <!--TRANSIT - CUSTOMLAYOUT(TOP)-->

    Place this token at the top of the layout template before the <HTML> tag. Your template could replace this value with an HTML declaration, such as the W3C document type identifier.

  • <!--TRANSIT - CUSTOMLAYOUT(HEAD)-->

    Place this token between the <HEAD> tags. Your template could replace this value with a web page title, meta tag keyword, and much more.

  • %%TRANSIT-BODYATTRIBUTES%%

    Place this token in the <BODY> tag. Your template could replace this value with a background color, text color, link behavior, and much more.

  • <!-- TRANSIT - CUSTOMLAYOUT(BODY) -->

    Place this token at the location where you would like your actual content items to appear on the web page. You will likely place this somewhere in the middle of your layout template. Your template will replace this value with each content item. This token can be used by itself to generate minimum HTML output so that the content item can be included in another web page. See Chapter 36, "HTML Snippets.".

34.4 Sample Layout Templates

A number of sample layout templates are available for download from Oracle Technology Network at http://www.oracle.com/technetwork/indexes/samplecode/. After downloading, check the sample into Content Server to begin using.

The following sample layout templates are available:

34.4.1 default_layout.txt

The default_layout.txt template wraps Content Server borders and navigation around your converted documents using Idoc Script and HTML tables.

Figure 34-3 Default Layout

Default layout page

The default_layout.txt layout template contains the following code:

<html>
<head>
<!-- TRANSIT - CUSTOMLAYOUT(HEAD) -->
<$defaultPageTitle="Converted Content"$>
<$include std_html_head_declarations$>
</head>

<$include body_def$>
<$include std_page_begin$>
<$include std_header$>

<table border="0" cellpadding="0" cellspacing="0" width="550">
<tr><td>

<!-- TRANSIT - CUSTOMLAYOUT(BODY) -->

</td></tr>
</table>

<$include std_page_end$>

</body>
</html>

34.4.2 snippet_layout.txt

The snippet_layout.txt template places the converted document on a web page, by itself, without the top, head, or body HTML markup. The result is very similar to what happens when there is no layout template associated, but the advantage here is that you can easily pull this content into another web page, possibly a portal site, as an HTML snippet.

The snippet_layout.txt layout template consists of a single line of code:

<!-- TRANSIT - CUSTOMLAYOUT(BODY) -->

This is a token that displays the actual content item on the web page. Since it used by itself here, minimum HTML output is generated which can be included in another web page or HTML snippets (see Chapter 36, "HTML Snippets").

Snippet Demo

The snippet_demo.hcst sample includes the basic ingredients for a portal-style web page that draws information (HTML snippets) from other content items stored in the Content Server, while preserving the borders and navigation.

The snippet_demo.hcst sample contains the following code:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>This is my incDynConv script test page</title>
<meta name="GENERATOR" content="Dynamic Converter">
<$defaultPageTitle="Converted Content"$>
<$include std_html_head_declarations$>
</head>

<$include body_def$>
<$include std_page_begin$>
<$include std_header$>

This is a sample page that shows how to include multiple snippets of dynamically<br>
converted content on a single page using the new Idoc function incDynamicConversion.

<table border="1" cellpadding="0" cellspacing="0" width="550">
    <tr>
        <td>
            <$incDynamicConversion("<source_contentID_1>","latest","<template_contentID_1>","snippet_layout")$>
        </td>
        <td>
            <$incDynamicConversion("<source_contentID_2>","latest","<template_contentID_2>","snippet_layout")$>
        </td>
    </tr>
    <tr>
        <td colspan=2>
            <$incDynamicConversion("<source_contentID_3>","latest","<template_contentID_3>","snippet_layout")$>
        </td>
    </tr>
</table>

<$include std_page_end$>

</body>
</html>

34.5 Creating a Layout Template for Your Content Items

To create and edit a layout template:

  1. Create a new layout template in a text editor or WYSIWYG tool. For information on the contents of a layout template, see Section 34.2.

    Tip:

    A number of sample layout templates are available for download from Oracle Technology Network at http://www.oracle.com/technetwork/indexes/samplecode/ that you can use as a starting point (see Section 34.4).

  2. Open the Dynamic Converter Admin page.

  3. Click Check In Existing Template and follow the steps to check in an existing template (see Section 32.4). Make sure that you choose Layout Template as the template type.

  4. Return to the Dynamic Converter Admin page.

  5. Associate your layout template with a template rule (see Section 34.6).

34.6 Associating a Layout Template With a Template Rule

You can associate a particular layout template with a template rule on the Template Selection Rules page. In the example in Figure 34-4, the template sample titled "default_layout" has been selected.

Figure 34-4 Selection of Layout Template on Template Selection Rules Page

The Template Selection Rules page

To specify a layout template for a template rule:

  1. Open the Dynamic Converter Admin page.

  2. Click Template Selection Rules.

  3. On the Template Selection Rules page, highlight the rule that you would like to specify a layout template for.

  4. Enter the content ID for the layout in the Layout text box (under the "Template and layout for selected rule" heading). You can also select the layout template from the Available Layouts menu.

  5. Click Update at the bottom of the page.

34.7 Specifying a Default Layout Template

In addition to associating a layout template with a specific template rule, you can also specify a default layout that is applied to all content items that do not match your defined template criteria. You specify the default layout on the Dynamic Converter Configuration page. In the example in Figure 34-5, the template sample titled "default_layout" has been selected.

Figure 34-5 Default Layout Template on Dynamic Converter Configuration Page

The Dynamic Converter Configuration page

To set the default layout template associated with your content items:

  1. Open the Dynamic Converter Admin page.

  2. Click Configuration Settings.

  3. On the Dynamic Converter Configuration page, in the Layout text box, under the Default Layout heading, enter the content ID for a layout template. You can also choose your desired layout template from the Available Layouts menu.

  4. Click Update at the bottom of the page to enable your default templates.

34.8 Including Scripts, Images, and CSS in a Layout Template

The layout template that you associate with your content items may include references to other files, such as custom scripts, images, Cascading Styles Sheets (CSS), and more. In fact, if you have a number of script templates that were created in an earlier version of Dynamic Converter, you can copy the Idoc Script tags from those templates and paste them into the new layout template. For more information, see Chapter 35, "Script Templates."

Identifying the appropriate path to use for an included file can be a challenge because the location of each content item checked into the Content Server may change if its metadata changes (metadata ultimately determines the URL of a content item). As such, you will not know the address of a new content item until it is checked into the Content Server with assigned metadata.

In this type of environment, relative paths create immediate problems. You must use a path that will work from anywhere in the Content Server. See Section 38.7 for a list of solutions.

Note:

To assign a default layout template to your content items, see Section 30.2. In earlier versions of Dynamic Converter (prior to version 6), default layouts were assigned as configuration variables in Content Server. You can now make this setting on the Dynamic Converter Configuration page.