ZimWeb Page Templates
ZimWeb includes page template support. This allows you to combine parameters from Zim with the page (web page, etc.) delivered to the client.
Template file format
A page template is just a regular page (HTML etc.), with parameter placeholders to indicate where each parameter to be supplied by the Zim application is to be placed. This template can be designed easily with your normal web page design tool.
The parameters placeholders are formatted like HTML comments (e.g. so for a parameter named company
you would use a parameter placeholder )
.
Note: the parameter and the parameter placeholder must be in the same case.
The page template processor will substitute the value of the parameter for the parameter placeholder. If the value of a parameter in a placeholder is not supplied, its value will be assumed to be blank. You can use the same parameter placeholder more than once in a given template.
Sample template
customer.htm
Parameter XML format
The Zim application supplies the values of parameters in an XML format.
The root element can have any name. The parameter names are the names of the elements which are children of the root element. The character content of each of the children of the root element is the value of the parameter.
An easy way to demonstrate this is by the following example:
Sample XML data
Note: the use of the
CDATA
section in the above to allow the company
parameter to include any characters. Alternatively the "&" character could have been replaced by its corresponding entity &
.