You are here: Re: [PHP] Re: Templating engines « PHP « IT news, forums, messages
Re: [PHP] Re: Templating engines

Posted by Rush on 04/30/05 20:18

> You also need to recognize that you are going to need presentation-layer
> logic. You simply can't get around that and you shouldn't confuse
> presentation-level logic, which can be quite complex, with the business
> logic behind your application. I often see people make the mistake of
> trying to separate their PHP code from their HTML which the article you
> referenced hinted at as well.

Yes, I completely agree that business logic should be separated from
presentation logic. Only problem I have is that from there people go on to
conclude that html does not need to be sseparated from presentation logic.
As far as I see It is a very good idea to keep all 3 of them separated.
Bussines logic from presentation logic by proper organization and code
design in php, and presentation logic from html by template engine.

> My main issue with general-purpose templating systems is that they
> always end up inventing a new language. It may start off as a subset of
> some other language, but eventually it turns into a new language. In
> Smarty, for example, you now have stuff like:

They have to define markup language, (begin/end of template, free variable
marker), but we are not talking about that.

What usually is the problem is that template systems define its own
programming language, with constrructs for loops, if's and whole other bunch
of stuff to model dynamic behavior. And I agree with you that this makes
diffrence between using such template system, and just php as template
system much, much smaller.

Where I do not agree, is that "fat template" syndrom is common to all
template engines, and that it is inveitable. For instance my TemplateTamer,
is now almost 5 years old, and it never had any sign of becomming
programming language in it self, and it never will. It has a markup language
of only 6 idioms:

<!--NAME: -->
<!--END: -->
<!--GLOBAL: -->
<!--USEGLOBAL: -->
{VARIABLE}
{#TRANSLATE}

and there is no single sign of presentation logic inside html template, no
ifs, no loops, no calls to the methods or functions, nada. All presentation
logic is written in php, and in nicely separated logic.php file.

rush
--
http://www.templatetamer.com/
http://www.folderscavenger.com/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация