Skip to content
Advertisement

Lightweight PHP5 based template class/system

Looking at using a template system for a new project, it’s only a small site and don’t want to use the overhead and ‘complexity’ of smarty. I don’t really like template systems that force you to make use of another language just to make it easier for designers (apparently).

Something like this http://www.namepros.com/code/517342-php5-template-class.html is what Im looking at but something which is a bit more robust and proven.

Advertisement

Answer

PHP by itself is already a template engine. So why not cut out the overhead a template engine written in a template engine brings with it and just use PHP then?

JavaScript

If you need added functionality, consider using ViewHelper, e.g. small functions that encapsulate stuff like adding links names or translating, e.g.

JavaScript

If that’s too verbose, have a look at HEREDOC and NOWDOC syntax and if this is still not what you are looking for, here is a list of some template engines:

Or, if you feel experimental, have a look at XHP, Facebook’s extension approach to a Template engine:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement