Re: FastTemplates and MySQL data?

From: Date: Thu, 28 Dec 2000 19:56:24 +0000
Subject: Re: FastTemplates and MySQL data?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-5496@lists.php.net to get a copy of this message
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 >

« previous php.db (#5496) next »