You are here: Re: templates? « PHP Programming Language « IT news, forums, messages
Re: templates?

Posted by Frank on 10/31/26 11:17

WebRod wrote:
> Hi,
>
> i want to rewrite my website to separate the php script from the HTML code.
> Therefore a web designer can update the design of the website without any
> knowledge in PHP.
>
> I read a lot of information about several templates like PhpLib,
> FastTemplates, Smarty etc etc.
>*snip*
> My question is, what is the interest to learn another language??
> What is the real interest of Smarty (or other one)?

The only advantage I can see is that these things force you to separate
presentation logic from the rest of your code, as they aren't general
purpose enough to do all that php can.

Using php for templating doesn't require all that much restraint imo
(you know things will get messy really fast if you do things the ugly
way), so I'd never introduce one more layer of complexity.

> So I really think it's better to have;
> - a php script which set some variables
> - a HTML templates which build the content of the page. It uses a lot of
> HTML tags and of course some really basic php function (if, foreach, echo).
>
> Of course the php script call the HTML template.
> You only use php, you work with the same variables, you don't need to call
> some specific functions (assign etc etc), you don't need to know another
> language etc etc.

Agree completely. My php projects consist of a controller/request
handler step (usually with a front controller/dispatcher in front of
that) and a display step.

The request handler usually calls out to object oriented business logic
which builds some kind of data model, and then include() the proper
template (which may of course include other templates again, but no
other php code).
For very simple stuff I sometimes drop the oo stuff and manage with just
request handler and template.

> Am I wrong??
>
> Is there any interest to use Smarty (or other one)??
> Why do they exist??????
> And maybe why do YOU use them????
>
> Manys thanks
>
> Rod
>
>

 

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

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