Re: [OT]: comments on the template engine example document

[email protected] (Monte Ohrt) Fri, 24 Mar 2000 08:58:07 -0600
Newsgroups php.template
Organization ispi
Message-ID <[email protected]>
jm wrote:
> 
> Yes, I still haven't figured out WHY there must be some logic in the
> templates...
> I'm gonna ask a few more designers about this, and I'll give you some feedback
> 


* Content must be separate from presentation, therefore...
* Programmers ONLY supply content to the template
* Designers must have full control of the presentation layout


For a good example (it works well, so I'll stick with it), we have an
application that displays news articles. Coders program the application,
then the designers build several templates for the presentation. Maybe
one template alternates table row colors, one does not. Maybe we want
<BR> tags before and after the section name, but only want one <BR> if
there is no section displayed.

These are reasons that the designer needs control of the presentation
layout. They can do these things, yet we can use the same application
(PHP) logic underneath the templates. If we have to make PHP code
changes for each template, this would quickly become unmanagable. Let's
say we have 30 clients, each with their own custom templates. Then it
comes time to upgrade the PHP logic underneath. In our template
scenario, you simply swap out the PHP logic since it is exactly the same
for all clients. If each one had different PHP logic (passing <BR> tags,
conditions, etc), who wants to manage that?

I can't stress enough, separate content from presentation. The PHP
application passes ONLY the content to the templates, then the template
logic constructs how the content is presented. I can see where this
would be a great benefit for many kinds of application built in PHP. We
run into it all the time.

Could some people share the method they write and design their
applications? I get a feeling that (for the most part) the people
reading these mailing lists are usually the coders and the designers, or
their applications are "write once, run once" so this need doesn't
necessarily apply. On the other hand, people that DO need this kind of
separation pass PHP by and stick with Cold Fusion (or whatever they are
comfortable with), because PHP does not offer this kind of thing. Yeah,
you say they can code what they need themselves. They're not interested.

Monte