Re: [SMARTY] Re: sections
| From: | Peter J. Pieczora | Date: | Wed, 25 Sep 2002 05:05:04 +0000 |
| Subject: | Re: [SMARTY] Re: sections | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6023@lists.php.net to get a copy of this message | ||
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.