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!


You can even generate a list of links dynamically for nav bar via:

"select page_name, page_id from Pvalues", if you account for performance
issues.

If the usre clicks on the "contact us" link, it returns a page_id value of
contactus.html.  So then:

"select * from Pvalues where page_id = "contactus.html"

Then call a templating parser and pass it the values of the select statement
and which template to use.

Can this be done, or I am way off base on this?

regards,
andrew









 On 1/13/01 7:27 PM, "Michael Kimsal" <[EMAIL PROTECTED]> wrote:

> I thought I understood your question, but I think I need a clarification.
> Can you elaborate a bit?  I think I have an answer, but I'm not 100% what
> you're meaning here.
> 
> Thanks.
> 
> 
> andrew wrote:
> 
>> Michael,
>> 
>> Wouldn't a benefit be that you could pass a database query in via that
>> variable, either via form submit or value of a clicked link?
>> 
>> I know PHP can do this without a separate templating engine, but if you do
>> use one then you can submit an array to a specific template.  Is there a way
>> to do this via built in functions without constructing the set of page
>> object's first, or can you only do this in templates?
>> 
>> regards,
>> andrew
>> 
>> On 1/13/01 7:06 PM, "Michael Kimsal" <[EMAIL PROTECTED]> wrote:
>> 
>>> 
>>> 
>>> [EMAIL PROTECTED] wrote:
>>> 
>>>> I looked around the web for templates and founf FastTemplates. Not exactly
>>>> what i was looking for thoug
>>>> lets say I have
>>>> $file = "111"
>>>> and there is a template "template.txt"
>>>> and it contains
>>>> "file #$file is blahlah"
>>>> 
>>>> how can I make that a template?
>>>> 
>>>> Thanks
>>>> - Peter
>>>> 
>>> 
>>> Any reason 'template.txt' couldn't just say
>>> 
>>> file $<?=$file;?> is blahlah
>>> 
>>> then include('template.txt'); in your main file?
>>> 
>>> Not sure why you'd want to complicate things with
>>> something like FastTemplates - I understand it has a use
>>> and purpose, but the only long term benefit I see from
>>> involved schemes like that won't be realized anyway
>>> (discussion for another day).
>>> 
>>> 
>>> 
> 


-- 
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