Re: My template idea...
[email protected] (Andrei Zmievski)
| Newsgroups | php.template |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 15 Feb 2000, Dan Libby wrote:
> 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.
Right, that's what I was trying to figure out - who should be
responsible for loading config files like that - developer or designer.
Does designer lose anything if the developer does it?
-Andrei
Complexity in the mind is not caused by learning;
learning is caused by complexity in the mind.
-- Steven Pinker