{PROJECT} ../../template/home_en.ini {GRAFIK_LINKS} $home/gifs/li_phpcms.gif {LOGO_1} $home/gifs/cmslogo1.gif {LOGO_2} $home/gifs/cmslogo2.gif {MENU} 00.08.10.03 {TITEL} Sub Templates {CONTENT}


What are Subtemplates?

If you have recurring HTML items in your templates, which should be alike however in all pages, you use at the best sub templates. Also within the same page (the same template) the same sub template can be used several times.

To use a sub template in a template file you must write a command like the following one:

{TEMPLATE FILE="/homepage/templates/sub_template.tpl"}

Note:The line must be written just as, thus in large writing and with one blank after the keyword "TEMPLATE". If you use simple or no quotes, the sub template cannot be found.

You can use absolute or relative path definitions to call a template. Optionally you can use the variable $home. Some examples for valid commands to call a sub template:

{TEMPLATE FILE="/homepage/templates/sub_template.tpl"}
{TEMPLATE FILE="./sub_template.tpl"}
{TEMPLATE FILE="$home/templates/sub_template.tpl"}

The variable $home is only defined if HOME is defined in the project file.

You can call sub templates also nesting, i.e. in a Sub Template a further Sub Template, but do not produce a recursion, when you try to call a sub template from the same sub template!

Except from these notes sub templates are just like normal templates!


Why sub templates?

Take for example the copyright text on the top right of the authors page. This text is with one email-links provided. The text occurs on all pages of my homepage. I use different templates on my homepage.

If now my email address changes, I would have to modify the new address in each individual template if i would'nt use sub templates. With sub templates I only have to modify the email address in one sub template and this modification affects all pages.

Sub Templates are thus used for items in the side structure, which are same on all pages.