Reply to Re: [PHP] Adding Loop / If support to a simple template engine

Your name:

Reply:


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;
}
=====

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация