Re: templates with php
| From: | Rasmus Lerdorf | Date: | Mon, 31 Jul 2000 22:41:26 +0000 |
| Subject: | Re: templates with php | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-9298@lists.php.net to get a copy of this message | ||
> Rasmus, your template sytsem certainly has matured, into the best
> server-side scripting language I have used (actually make that the best
> scripting language I have used period.) What it isn't any more - at least to
> me - is a template system. Perhaps we need something like the PHP Template
> Engine to give us that back?
The fact that it can do a lot more does not invalidate it asa template
system.
A concrete example:
<? require "logic.inc" ?>
<TABLE>
<? while(fetch_products()): ?>
<TR><TD><?=$name?></TD><TD><?=$price?></TD></TR>
<? endwhile ?>
</TABLE>
It should be obvious what fetch_products() would look like in logic.inc
My main beef with templating systems is that they do not give the
designers enough credit. And the ones that do, do so in a way that the
poor designer ends up learning a complex and useless tag language (like
CF) that doesn't translate to anything else.
By having designers slowly learn what a while loop is. And then perhaps
an if/else condition. You might find that eventually they will be able to
handle making changes to logic.inc and pretty soon the sharper ones will
completely eliminate any need for a "programmer" to have to keep
babysitting them.
I have run across a number of people over the years that told me that they
learned how to program from using PHP. All they could manage in the
beginning was to use include "header.html" type stuff. But the fact that
they were not limited to this inspired them to keep trying new things.
On a number of large projects I have created short cheat sheets for the
HTML jockeys. As they asked for more entries to be added to the cheat
sheet I started showing them how and where these magical tags were
defined. Pretty soon they stopped asking me for stuff and they managed to
maintain logic.inc on their own. They still maintained the code
separation between layout and logic, but because the tool and scripting
language they used for both were one and the same, they didn't have this
insurmountable mental barrier of being forced to "program" just to
manipulate the logic a bit. If I had created some artificial stripped
down template language for them, I'd still be getting requests for new
tags today, two years later.
-Rasmus