"Jean-Marc Molina" <go****************@ifrance.com> wrote in message
news:bl**********@news-reader5.wanadoo.fr...
Hi Rush,
I personaly prefere it when html and code are in completely separate
files.
Don't forget that a Template Engine is not supposed to separate PHP code
from HTML but business logic from presentation logic.
There are different school of thoughts on this, and I do not prefer the one
you propose, while I accept that it works for you and that you prefer it.
I think Template engine purpose _is_ to separate html from code. And that
bussiness logic shoud be separated from presentation logic by organizing
your code in MVC, or MVP patterns where business logic goes into M. But it
is the code part that separates presentation logic and bussines, not
templates which are used to separate html which define pure visial
appearance, and code defines presentation logic. It is much clear in
languages that come with MVP out of the box, like Dolphin Smalltalk. There
you have View composer, where you paint the appearance of the GUI and it
gets stored as a resource. It is equivalent of html. Than there is
Presenter, which is pure code and contains "Presentation" logic. And there
is Model that contains bussines logic.
The idea that template purpose is to separate business logic from
presentation has lead to "dirty" templates which contain both code and html.
In this scenario code (not necessary a php code, but code with loops, ifs
and other constructs anyway), is embeded into the html template. Most
prominent and respected examples of such approach would be XML+XSLT and
Smarty.
Again, both approaches work and some people like one, and some people like
onother, but it is by no means such a clear cut, and just a single "proper"
way to approach things.
Thanks,
rush
--
http://www.templatetamer.com/