Posted by Adrian on 04/07/05 07:50
Just make your template engine compile templates to "native" php code.
i.e. write a parser which replaces {if $foo}{$var}{/if} with
<?php if($foo) {?><?php echo $this->templateVars['var'];?><?php } ?>
To check if the template must be recompiled, just compare filemtimes.
The assign function could be look like this then:
=====
function assign($varName, $value = '')
{
if(is_array($varName))
foreach($varName as $key => $val)
$this->assign($key, $val);
else
$this->templateVars[$varName] = $value;
}
=====
Navigation:
[Reply to this message]
|