More information about the Underscore mailing list

[_] PHP - working with HTML templates

Richard Davey rich at
Tue May 11 15:10:32 BST 2004

Hello Alex,

Tuesday, May 11, 2004, 2:55:49 PM, you wrote:

AB> What's the consensus on the best way of managing HTML templates within
AB> PHP - i.e. separating code and HTML? I'm looking at HTML_Template_IT
AB> and HTML_Template_ITX in PEAR which seem to do the job - is there much
AB> difference between them?

There are many different ways/views on doing this - from the "PHP is a
templating engine anyway" approach, to those who favour the
Smarty/Pear options. At the end of the day though it depends entirely
on the site in question. If you're after a simple templating system
that doesn't need all of the in-built logic support that HTML Template
and Smarty offer, then you could easily write one in a matter of
hours. Abstracting the code from the design is certainly a good thing
to do, but it can go overboard at the same time - PHP is designed and
coded specifically to actually be integrated with HTML after-all! But
it depends on the site/client/you/etc. Personally I use either "No
template at all", "my own Template system" or Smarty depending on the
task in hand.

Best regards,
Richard Davey