Templages engine
Templates engine support PHP tags. Also it has own tags.
Supported tags are
a. Any template variable can be {$var} - it's like <?php echo $var; ?>. If it's array or object - use same way as PHP, for example {$var['var']}
b.
{foreach $array as $k=>$v}
{/foreach}
will be
<?php
foreach ($array as $k=>$v) {
}
?>
You still can insert {$v} tag
And so on. So instead of <?php CODE ?> you simple write {CODE}, similar what saves you time. Look below to learn more(no PHP tags in examples).
c. {if $tmp == '1' or $var == '2'} {/if}
will be
if ($tmp == '1' or $var == '2') {
}
Same is
{elseif [CODE]}
and
{else}
d.
{php $var = 1+2;}
It's just to wrap to the inside content.
e. {price $var}
It will ouput currency symbol and price with .00 at the end.
f. {weight $var}
It will ouput weight symbol and weight with .00 at the end.
g. {include="TEMPALTE PATH"}
for example {include="common/products.php"}
h. {lng[Hello world]} - language variable. Useful if you translate or use multi-lingual site.
All tags and {lng..} stored in cache and not processed on every page load.
{lng[Hello|lower]} - lowcase.
{lng[Hello|js]} - replace line breaks and " character with \".
{lng[Hello|escape]} - replace " character with \".
You can also use {lng} in JavaScript - they are processed as well. JavaScrpt already do all the work so it does not support additonal modifiers like "lower".
i. Easier than {php } for assignments
{assign $var=1+2}
Output
$var = 1+2;
Full templates engine is in the includes/func/func.core.php file
function get_template_contents
Easy to customize or add new template tags for even new developer.