Re: templates?
- From: Frank <abc@xxxxxxx>
- Date: Mon, 30 May 2005 18:00:26 +0200
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
.
- References:
- templates?
- From: WebRod
- templates?
- Prev by Date: index page query from PHP newbie
- Next by Date: php session tracking and MySQL?
- Previous by thread: Re: templates?
- Next by thread: Re: templates?
- Index(es):
Relevant Pages
|