RE: [PHP-DB] FastTemplates and MySQL data?

From: Date: Fri, 29 Dec 2000 13:58:38 +0000
Subject: RE: [PHP-DB] FastTemplates and MySQL data?
References: 1  Groups: php.db php.general 
Request: Send a blank email to php-general+get-32203@lists.php.net to get a copy of this message
Hi Jayme, I'm not sure I understand - do you happen to have an example of using a variable as a create parameter? regards, andrew > ------ Forwarded Message > From: "JJeffman" <jjeffmanweb@conex.com.br> > Date: Thu, 28 Dec 2000 17:56:24 -0200 > To: <php-db@lists.php.net> > Subject: Re: [PHP-DB] FastTemplates and MySQL data? > > FastTemplate is not a MySQL neither a PHP function or object. If > you create > a php class named FastTemplate which has a php variable as create > parameter > you can use it just the way you wrote in your previous message. > > Jayme. > > http://www.conex.com.br/jjeffman > > > > -----Mensagem Original----- > De: Andrew <andrew@salamander.net> > Para: <php-general@lists.php.net>; <php-db@lists.php.net> > Enviada em: quinta-feira, 28 de dezembro de 2000 15:04 > Assunto: [PHP-DB] FastTemplates and MySQL data? > > > > This is a second post, since no one responded the first time... :) > > > > Can I somehow pass FastTemplates a MySQL result array, and also > pass it a > > template pointer, and get a resultant page? I really just want > to set up > a > > script where a Select parameter is passed in, a result set array is > > generated, and the array is evaluated against an array of template {} > > variables. This way I can call pages with essentially one variable. > > > > Any ideas? > > The original post is below. > > > > TIA! > > andrew > > > > > Hi, > > > > > > <NEWBIE ALERT> > > > > > > Can anyone show me an example (or better, point me to some code) > > > where the FastTemplate class pulls info from MySQL? > > > > > > e.g. something like this maybe?: > > > > > > <? > > > $sql = "select * from database where id = id"; file://to get one > row > > > $location = "path/to/template/directory"; file://one per > template set > > > > > > mysql_connect($hostname, $user, $password); > > > > > > $result = mysql_db_query ("database", $sql); > > > while ($row = mysql_fetch_assoc ($result)) > > > > > > { > > > echo $row["field1"]; file://maybe build dynamically with a > for loop? > > > echo $row["field2"]; > > > } > > > > > > mysql_free_result ($result); > > > > > > $tpl = new FastTemplate($location); > > > $tpl->define(array ($result, main => main.tpl)); // help! > > > ?> > > > > > > So basically every page (or page section) can be stored as > one row in a > > > database and to get your script to generate a different page you just > have > > > to pass $sql and $location, since $location defines a set of > > > templates that > > > work together to define your page and $sql defines which result > > > set will get > > > parsed against the *.tpl in $location > > > > > > > > > I can't believe that this hasn't been done before, but I'm too > > > green to know > > > exactly what to do here... > > > > > > > > > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > > For additional commands, e-mail: php-db-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > ------ End of Forwarded Message > >

« previous php.general (#32203) next »