If statements in template system

Speedy Wap picture Speedy Wap · Feb 9, 2011 · Viewed 13.2k times · Source

How can I parse, let's say, {if $var > 2} or {if $var} in a .tpl file in my own version of a templating class. I do not wanna use smarty as I don't need all their plugins. I just want include, if, for and foreach statements.

Answer

AntonioCS picture AntonioCS · Feb 9, 2011

Please use php. Just put in your tpl file:

<?php if ($var > 2) .... ?> 

It's a lot simpler, less code and a lot faster than parsing the file in php