Classic HTML Conversion Layout Templates 6-7
Configuration page see Dynamic Converter Configuration Page
on page A-2. In the example below, the template sample titled default_layout has been selected.
Figure 6–5 Default Layout Template on Dynamic Converter Configuration Page
To set the default layout template associated with your content items, complete the following steps:
1.
Open the Dynamic Converter Admin page see Dynamic Converter Admin Page
on page A-1.
2. Click Configuration Settings.
The Dynamic Converter Configuration page is displayed see Dynamic Converter
Configuration Page on page A-2.
3. 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.
6.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. See
Chapter 7, Script Templates for more
information on 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
Relative URLs in Templates and Layout Files
on page 10-4 for a list of solutions.
6-8 Administrators Guide for Dynamic Converter
Note: To assign a default layout template to your content items, see
Setting the Default Template on page 2-1. 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 see Dynamic
Converter Admin Page on page A-1.
7
Script Templates 7-1
7
Script Templates
This section covers the following topics:
■
About Script Templates on page 7-1
■
Elements on page 7-2
■
Indexes on page 7-9
■
Macros on page 7-12
■
Pragmas on page 7-30
■
Sample Script Templates on page 7-32
■
Setting Script Template Formatting Options on page 7-42
■
Breaking Documents by Structure on page 7-43
■
Breaking Documents by Content Size on page 7-46
■
Using Grids to Navigate Spreadsheet and Database Files on page 7-48
7.1 About Script Templates
Script templates are the text-based conversion templates that were primarily used in earlier versions of Dynamic Converter. They are plain-text files that must be
hand-coded with elements, indexes, macros, pragmas, and Idoc Script. You can still use this template format in Dynamic Converter, but Classic HTML Conversion
templates see
Chapter 5, HTML Conversion Templates have, for the most part,
replaced script templates.
The following is the code for a very simple script template: { unit}{ header}
html body
{ header} pHere is the document you requested.
{ insert element=property.title} by { insert element=property.author}p
pBelow is the document itselfp { insert element=body}
Note: See the Content Server developer documentation for more
information on Idoc Script.
7-2 Administrators Guide for Dynamic Converter
{ footer} body
html { footer}{ unit}
The { unit}, { unit}, { header}, { header}, { footer} and { footer} macros can be ignored for the moment. Their purpose is described in
Macros .
The remainder of the file is regular HTML code with the exception of three macros in the form { insert element=xxx}. Dynamic Converter uses this template plus the
source file to create its output. To accomplish this, Dynamic Converter reads through the template file, writing it byte for byte to the output file unless character mapping is
performed on the template. This continues until the template contains a properly formatted macro. Dynamic Converter reads the macro and executes the macros
command. Usually this means inserting an HTML version of some element from the source file into the output file. Dynamic Converter then continues reading the
template and executing macros until the end of the template file is reached.
In the example above, the first { insert} macro uses the element syntax described in Insert Element: { INSERT}
to insert the title of the document. The second macro inserts the author of the document and the third macro inserts the entire body of the
document. The resulting HTML might look like this HTML that is the result of a macro is in bold:
html body
pHere is the document you requested. A Poem
by
Phil Boutros
p pBelow is the document itselfp
pRoses are redp pViolets are bluep
pIm a programmerp pand so are youp
body html
7.2 Elements