Re: Templates

From: Date: Mon, 15 Jan 2001 01:09:09 +0000
Subject: Re: Templates
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-34525@lists.php.net to get a copy of this message
well, I suppose it could, but it's pretty weird... why would you want to directly hook up presentation w/sql queries ? :) -a -- Alex Black, Head Monkey enigma@turingstudio.com The Turing Studio, Inc. http://www.turingstudio.com vox+510.666.0074 fax+510.666.0093 Saul Zaentz Film Center 2600 Tenth St Suite 433 Berkeley, CA 94710-2522 > From: andrew@salamander.net (andrew) > Newsgroups: php.general > Date: 13 Jan 2001 17:06:48 -0800 > Subject: Re: [PHP] Templates > > 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 someone@somewhere.com > 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" <michael@tapinternet.com> 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" <michael@tapinternet.com> wrote: >>> >>>> >>>> >>>> PeterOblivion@aol.com 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: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#34525) next »