Re: template engine...why???

From: Date: Wed, 30 Apr 2003 20:16:26 +0000
Subject: Re: template engine...why???
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-145851@lists.php.net to get a copy of this message
I think you guys are missing the point I was trying to make. My first point was that it is not possible to build a general-purpose templating system that won't eventually evolve into PHP. Then my second point was that it is very possible to build very specific templating solutions using PHP. So, to answer your question. My PHP template to do what you are after looks like this: <html> <?user_table()?> </html> And the user_table() function is defined in the template helpers layer. As far as I am concerned templates should not have any sort of logic in them, including iterators. But this is a religious issue that nobody can agree on and I don't expect to see agreement here. -Rasmus On Wed, 30 Apr 2003, Seairth Jacobs wrote: > I see all sorts of problems with this approach, the least of which is that > you are using your own language constructs. You are no longer using native > PHP. Rasmus, however, claims that it can all be done with PHP itself (if I > understand his statements correctly). So, how can the example table be done > entirely within PHP while keeping to the two constrains below? > > --- > Seairth Jacobs > seairth@seairth.com > > > "Luis" <luis@fuegolabs.com> wrote in message > news:014001c30f3d$ca8a7880$2b00a8c0@fuegolabs.com... > > > > > > <table> > > {section loop=$foo name=i} > > <tr><td>{$foo[i]}</td></tr> > > {/section} > > </table> > > > > > > > > From: Seairth Jacobs [mailto:seairth@seairth.com] > > > > Can you tell me how you handle something like generating an arbitrary > > number > > of <tr>s in a table while: > > > > 1) Not using a runtime templating approach, and > > 2) Still allowing the <table> and <tr> presentations to be altered (say, > > switching to use of <divs>) without giving access to the underlying > > logic. > > > > > > "Rasmus Lerdorf" <rasmus@lerdorf.com> wrote in message > > news:Pine.WNT.4.53.0304300801440.728@DELL... > > > > > > The only templating systems I can honestly say are complementary are > > the > > > ones that pre-generate pages so there is absolutely no run-time hit > > from > > > the templating system. Anything that parses template files and by > > > whatever means does search and replace stuff at runtime is just > > inherently > > > nasty if you care about performance at all. > > > >

« previous php.general (#145851) next »