Documentation: template language

To render a web-page, iWebCMS uses a MyTemplate engine. This is a quite simple but fast perl module transforming a number of templates and data space into an html file. A template itself consists of an arbitrary text (html in most cases) with special tags which direct template engine how to generate a page.

Each tag is incapsulated in # signs, for example: #I:pageinfo/title#, #if news#, #foreach {nav}#.

A simple web-page example:

<html>
<title>#pageinfo/title#</title>
<body>
#preload_nav()#
<ul>
#foreach navitem {nav}#
<li><a href="#navitem/link#">#navitem/name#</a></li>
#/foreach#
</ul>
<h1>#pageinfo/title#</h1>
#pager()#
</body>
</html>

Futher reading

The "space" - describes a structure interconnecting template engine with logic engine.

Data output - how to insert dynamic data which the space stores.

Flow control tags - when template is interpreted by engine, there can be loops, conditions, other templates inclusions.

Function calls - most important part of template engine.

Template customization - every template can be redefined.

Localization - ability to generate in-template messages in different locales.

 





©2008 Olenin Vladimir. www.dihost.ru