Re: My template idea...

From: Date: Tue, 15 Feb 2000 20:51:07 +0000
Subject: Re: My template idea...
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.template 
Request: Send a blank email to php-template+get-44@lists.php.net to get a copy of this message
The PHP code would, eg: globals.php ----------- $global_attrs["page_bgcolor"] = "white"; $global_attrs["page_width"] = "600"; randomfile.php --------------- <?php include "globals.php"; ?> #load template $tmpl = tmpl_define("randomfile.tmpl"); #assign global vars tmpl_assign($tmpl, $global_attrs); # assigns set of key/val pairs in one call. #print template echo tmpl_getbuf($tmpl); randomfile.tmpl ---------------- <body bgcolor="{{page_bgcolor}}"> <table width="{{page_width}}"><tr><td>random stuff</td></tr></table> </body> ...and of course the same variables could be used in other PHP code that doesn't use templates simply by referencing $global_attrs. -dan Andrei Zmievski wrote: > On Tue, 15 Feb 2000, Dan Libby wrote: > > The same thing can be done with PHP includes. Further, the values can then be > > either static or dynamically retrieved from a database. The only reason I can think > > of to use a conf file instead is speed. > > Would the template include the file that sets up colors/fonts or would > the PHP code do that? > > Another reason is easy editability. > > -Andrei > * If it's never finished, you can't prove it doesn't work. *

Attachment: [text/x-vcard] Card for Dan Libby danda.vcf
« previous php.template (#44) next »