rush wrote:

"Mattias Thorslund" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]


(On the subject of templating engines, again.)

I wonder what you folks think of the following:
http://www.massassi.com/php/articles/template_engines/



hi!

It is nicely written, but actually, I think completely oposite from you. The
way I see it, the statement that "template system purpose is to separate
bussines logic from presentation", is the biggest missconception about
templates :)



Nice turn of phrase. It took me a while to see that you didn't misread the article. :-P


Not that I think that bussines logic should not be separated from
presentation logic, it is only that I think that it shold be separated in
your php code design, l, not by the template system. And html, and code
should be separated, one is used to model static and visual concepts, and
another to model dynamic concepts. And they usually get defined by people
with completely different skills and even mindsets.



I suppose this depends on the situation. If the graphic designers are "allergic" to seeing <?=$var;?> instead of {$var}, I suppose a templating engine like Smarty or TemplateTamer is the way to go. Or, if you wanted to prevent the graphic designer from adding some complicated PHP code in the code , say because they don't understand how to structure the code. Or, because the templates will be created and uploaded by people who shouldn't have access to upload PHP code to the server.


As for the article, I know the author describes putting even pretty complicated presentation logic in the template. I agree that that's probably not such a good idea. But I don't see where the PHP-as-templating engine concept implies that you couldn't also separate the business logic from the (dynamic) presentation logic in the php code, before calling the template. The static layout in the PHP 'template' file is basically HTML only, with placeholders for the dynamic data - only that the placeholders are also valid PHP, not yet-another language.

Anyway, I do not think there is "One Right Way", of looking at templates. I
for one would never be satsfied with "fat" temlates like they are in Smarty
for example. But on the other hand I understand that there are people that
would never trade their Smarty templates. So as we do not get to exclusive
about how thing must be done, we could get along nicely :)



Agreed. I don't lose sleep over it :-)

/Mattias

--
More views at http://www.thorslund.us



Reply via email to