assign
| From: | Peter J. Pieczora | Date: | Sat, 28 Sep 2002 03:30:24 +0000 |
| Subject: | assign | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-6037@lists.php.net to get a copy of this message | ||
Hi,
It's really a newbie question, so if my lingo isn't quite right please forgive
me.
How can I assign variables to the template called from index.tpl?
In my case when I do $t->display('mypage.tpl'); it all works fine, but in case
when I call the page from $t->display('index.tpl'); and do
$t->assign("Content", "$template"); it doesn't.
Providing mypage.tpl needs to access db to pull data out to display.
$query = "SELECT * FROM $table WHERE id='$id'";
$result = mysql_query($query1);
while ($data = mysql_fetch_array ($result))
{
$c_length .= $data1[c_length];
$c_dates .= $data1[c_dates];
......
}
$t->assign("c_length", "$c_length");
$t->assign("c_dates", "$c_dates");
Peter