Re: templates with php
| From: | Monte Ohrt | Date: | Mon, 31 Jul 2000 21:14:42 +0000 |
| Subject: | Re: templates with php | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-9280@lists.php.net to get a copy of this message | ||
Keith Devens wrote:
>
> > > Plus, template engines can have added features such as table building.
> > > Eg:
> > >
> > > <TABLE>
> > > <LOOP NAME="deidre">
> > > <TR><TD>{stuff}</TD></TR>
> > > </LOOP NAME="deidre">
> > > </TABLE>
> > >
> > > This could build an entire table with however many rows (dependent on
> > > whats in the array (or sql result set) $deidre), and the designers still
> > > have full control on how the table looks. Not sure how you could do this
> > > with your method (though I've not really thought about it that much
> > > :) ).
> >
> > <TABLE>
> > <?loop("deidre")?>
> > <TR><TD>whatever</TD></TR>
> > <?endloop("deidre")?>
> > </TABLE>
> >
> > Not very different at all.
> >
> > And I can guarantee you that this is faster.
> >
> > -Rasmus
>
> This is exactly what I was wondering about. How might this be implemented?
> How can one function start a loop and then another function end it?
>
This subject has been brought up many times, including from myself. I
have no idea
how you would expect this to work:
<?loop("deidre")?>
<TR><TD>whatever</TD></TR>
<?endloop("deidre")?>
since the loop() and endloop() functions have no effect on the html
between them. You need functionality similar to output buffering,
although the two are entirely different since there is no output buffer
to work with. That is why the php template engine project was born many
months ago. You can check it out here:
http://toye.php.net/~andrei/tpl-engine.html
although it has made little progress lately because of the uproar it
made regarding such a new "template syntax" for PHP, which is something
everyone has their own opinion on.
Monte