LICENSE
Template Compiler
OSI Certified Open Source Software
Copyright (c) 2003 Computel Standby BV
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
We explicitly claim no rights to the output generated by this program.
SHORT MANUAL
The template style for this template compiler is based on the phpBB template style. There are three types of control statements that can be used in the templates. These are explained below. The dynamic content for the template can be stored in a dictionary which is then applied to the template. In the examples we call this dictionary: content_dict
Control structures:
- Variable substitution:
Every occurrence of
{VARIABLE_NAME}
will be replaced with the content of
content_dict['VARIABLE_NAME']
- Loops: A loop will show the content of a list of sub-dictionaries. This can be best explained with an example. Take for example the following content_dict:
content_dict = {
'TITLE': 'This is a title',
'ITEMS': [{
'NAME': 'Item one',
'VALUE': 'Value one'
}, {
'NAME': 'Item two',
'VALUE': 'Value two'
}]
}
Which can be applied to the following example template:
<html><head>
<title>{TITLE}</title>
</head><body>
<h1>{TITLE}</h1>
<table>
<!-- BEGIN ITEMS -->
<tr>
<td>{ITEMS.NAME}</td>
<td>{ITEMS.VALUE}</td>
</tr>
<!-- END ITEMS -->
</table>
</body></html>
This will result the following output:
<html><head>
<title>This is a title</title>
</head><body>
<h1>This is a title</h1>
<table>
<tr>
<td>Item one</td>
<td>Value one</td>
</tr>
<tr>
<td>Item two</td>
<td>Value two</td>
</tr>
</table>
</body></html>
