andrew wrote:
> 
> Sure,
> 
> My understanding of templating engines
>     1.array or item is assigned to a variable
>     2.php placeholders in a html page match in name to above variable.
>     3.a parser separate from php subsitutes the variable values set in (1)
> into (2)
> 
> I've seen plenty of examples where there is a file containing lists of
> variable to item assignment, and thase files are passed to a one of a few
> template pages for layout.
> 
> There must be a way to pass the result set of an SQL query into the set of
> placeholders - the end result would be that you could call whole sites via
> simple queries. All you have to pass in would be the SQL parameter.
> 
> i.e. Table named 'Pvalues'
> 
> Pvalues                 Sample Row
> ----                    ------
> page_id                 contactus.html
> page_name               Contact Us
> page_title              Contact US
> header_text             Please send an email
> body_text               [EMAIL PROTECTED]
> footer_text             thanks!

Check out http://www.scripps.edu/~jesusmc/cachedtpl/CachedTemplate.html
by Jesus M Castagnetto. His class solves the problem with caching
templates for all the template classes he has found.

One of those he found was a class called XTemplates, that class have
some very good functions, you could write this in your templae page:

{Pvalues.page_id}

and in the php page you could assign the result set directly to Pvalues,
and all items called Pvalues.something would be filled out with the
column of the same name.

The only drawback of XTemplates is that it adds some extra spaces to the
output, which on large pages might amount to quite a bit, but since
you're complentating working something like this out, you might instead
rewrite this class to remove that bit of a problem. (I haven't had the
time to track the bug down myself.)

Some timings I've made have shown that XTemplates on a large result set
seems to be only 10% slower than the templates which comes with PHPLib,
which is pretty good.

Finally it is much easier to use and initalize than any template engine
I've tried.
-- 
Paul K Egell-Johnsen
Developer/PR Manager
zez.org: about code
http://zez.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to