Templight

Get started with TempLight

Inheritance

A very usefull feature of a decent templating language is the inheritance. This allow you to create flexible master page :

First we need a master template "masterpage.html" :

<html>
    <title><block name="title">Default title</block></title>
    <body>
        <block name="content">
        Default content
        </block>
    </body>
</html>

And later we extends the master template with another template file. The block tags of the master template are the parts that must be redefined.

<extends path="masterpage.html"/>
<block name="title">My title !</block>
<block name="content">
My content !
</block>

We could also use the include tag to get data from a another template :

<include path="inclusion.html"/>

For the moment these read on disk operations aren't cached by TempLight but this could be acheived very easily if needed.