Re: Please: XTemplate help?

From: Date: Sat, 20 Jan 2001 17:26:30 +0000
Subject: Re: Please: XTemplate help?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-35814@lists.php.net to get a copy of this message
require "xtpl.p"; //include XTemplate engine //don't need this - wrong. > require "html.xtpl"; //html layout file with field names e.g. {firstfield} You need to create a new instance of the Xtemplate class so: //assign the new instance to a variable name you'll use - I called it $template //and I specified which "html layout file" to use. $template = new Xtemplate("html.tpl"); // I name them tpl not xtpl *shrug* while($row = mysql_fetch_array($result)) { $template->assign("FIELD1", $row[fieldname]); //FIELD1 being the name you're going to use in the layout file by {FIELD1} //$row being the name of the array you fetched, field name being the fieldname in the database $template->assign("FIELD2", $row[fieldname2]); $template->parse("main");//replace {field} with matching result row element $template->out("main");` //send final html page to browser } Kristi

« previous php.general (#35814) next »