Re: My template idea...

[email protected] (Dan Libby)
Newsgroups php.template
Message-ID <[email protected]>
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. *
danda.vcf (text/x-vcard, 304 B)
begin:vcard 
n:Libby;Dan
tel;work:650-210-2356
x-mozilla-html:TRUE
url:http://www.epinions.com
org:Epinions.com;Engineering
adr:;;;;;;
version:2.1
email;internet:[email protected]
title:Morlock
note:We're hiring at epinions.com.  Engineers, site designers, QA -- we need you.
fn:Dan Libby
end:vcard
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.