On 9 Oct 2002 at 17:48, Dave Smith wrote:

> I agree that it is always good practice to use good design even for
> small projects, because they almost invariably turn into large projects
> if you don't. ;)
> This has been some great info. I appreciate it. Can someone explain what
> the purpose of a template engine is and possibly draw up a simple
> diagram of how one might work as it relates to DB-related projects?

The answer to this question goes beyond any language. I've done this in 
Perl and my apps can use either the Great Template::Toolkit or the 
esteemed HTML::Template. I have a Viewer class which receives the DATA 
(the DATA) and a request for a template handler (TT or HT in my cases 
but could be more) and the Viewer than manage the manipulation of the 
data with how the particular template system uses the data.

You can see an example of the above here:


The default view uses TT, you can click on Simple and you will get the 
original HT templates. You can click on ViewSkel so see the template 
and DATA used to create the view.

I did that quite awhile ago. I've done a few apps with Smarty now. I 
think Smarty is pretty darn good. Got nearly everything I want.

Why a templating system? Because I find it much easier to build, to 
debug and to evolve an application that has a clean structure. Never 
mind needing to update the whole design. All this talk of "skins" in 
most PHP stuff drives me nuts. They are not skins, they have no 
template system, it's a hodegepodge that will drive any efficient 
minded person insane :):) ... been doing a lot of work on other systems 
in PHP to get paid. I've also been writing some fresh apps using Smarty 
and it's a pleasure. Clients are amazed at how easily I can make 
changes ONCE (very important) once I've got the layout (the blueprint 
if you will) of my class structure. I use PEAR as well. The DB is good. 


PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to