Re: [SMARTY] Re: sections

From: Date: Thu, 26 Sep 2002 07:59:19 +0000
Subject: Re: [SMARTY] Re: sections
References: 1 2 3  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6025@lists.php.net to get a copy of this message
Have you seen the pdf manual about retrieving templates from database? That should solve your problem HTH, Ernani "Peter J. Pieczora" <pjpieczora@sympatico.ca> escreveu na mensagem news:200209250005.04482.pjpieczora@sympatico.ca... > On September 23, 2002 2:54 am, Ernani Joppert Pontes Martins wrote: > > How are you getting the template from the database ? > > > > Can you tell us ? > > > > So then is more easy to discover the problem > > > > Cheers, > > > > Ernani > > Couldn't get back on the subj. any sooner because my box had a little problem, > IBM harddrive trouble :-(, LOL. > > This is how i'm loading *.tpl from db: > $table ="templates"; > $db = DB::connect( "$dsn" ); > $query = "SELECT * FROM $table where page='$page'"; > $result = mysql_query($query); > while ($data = mysql_fetch_array ($result)) > { > $page .= $data[page]; > $page_title .= $data[page_title]; > $page_subtitle .= $data[page_subtitle]; > $page_navigation .= $data[page_navigation]; > $page_layout .= $data[page_layout]; > $template .= $data[template]; > } > switch ($page) > { > case "": > > $smarty->assign("title", "$title"); > $smarty->assign("subtitle", "$subtitle"); > $smarty->assign("Content", > $smarty->fetch("home.tpl")); > //$smarty->display("1/index.tpl"); > break; > default: > $smarty->assign("page", "$page"); > $smarty->assign("title", "$title $page_title"); > $smarty->assign("subtitle", "$page_subtitle"); > $smarty->assign("navig", $smarty->fetch("$page_navigation")); > $smarty->assign("Content", "$template"); > break; > } > if (!isset($page)) { > $smarty->display("1/index.tpl"); > } else { > $smarty->display("$page_layout/index.tpl"); > } > > Well, there are probably better ways to do that but that's what I came out > with, so far.

« previous php.smarty.general (#6025) next »