Re: [PHP4BETA] RE: Asking for the impossible?
| From: | Stefan Lindmark | Date: | Sat, 25 Mar 2000 11:39:18 +0000 |
| Subject: | Re: [PHP4BETA] RE: Asking for the impossible? | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-12586@lists.php.net to get a copy of this message | ||
If the purpose is to separate presentation and logic, perhaps you should
take a look at the FastTemplate class that does exactly that.
http://www.thewebmasters.net/php/FastTemplate.phtml
A tutorial is available at:
http://www.phpbuilder.com/columns/sascha19990316.php3
I haven't put templates to active use myself (yet) but I wish I had for
a project I'm running now, since I will have external HTML people doing
some GUI work. With the mixed HTML/PHP the project is written in now,
this is done inefficiently.
§
Peter Kocks wrote:
>
> >
> > Try
> >
> > $s = $cart->show();
> > $c = $cart->count;
> >
> > // A here doc
> > print <<< END
> > <HTML>
> > Status: $s
> > Count: $c
> > </HTML>
> > END;
> >
>
> Yes, this will work, but it does not allow for the calling
> the method within the string. I tried to keep the example
> simple, but there is a next step that makes this technique
> powerful.
>
> Consider,
>
> // A here doc
> print <<< END
> <HTML>
> Status: {$cart->show()}
> Count: {$cart->count}
> <TABLE>
> Contents:<p>
> {$cart->table("<TR>", "</TR>",
> "<TD>", "</TD>")}
> </HTML>
> END;
>
> The table() method would take four arguments, a pre-string
> and post-string for rows and cells of the table.
>
> The ultimate objective being to create a framework where
> here docs contain all of the relevant HTML code and the php
> class contains all of the php logic. I think a system would
> be nice because it would be easier to do all of the HTML
> formatting in one place.
>
> --pk
>
> --
> PHP 4.0 Beta Mailing List <http://www.php.net/version4/>
> To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net
> For additional commands, e-mail: php4beta-help@lists.php.net
> To contact the list administrators, e-mail: php4beta-admin@lists.php.net
--
Stefan Lindmark, M.Sc.C.Sc | Tel +46 (0)8 623 9182
SE Manager | Mobile +46 (0)70 623 9182
Sun Microsystems AB | Fax +46 (0)8 623 9005
Box 51, S-164 94 Kista, Sweden | E-mail
stefan.lindmark@sweden.sun.com