PEAR::DB and Smarty
| From: | Eskil Kvalnes | Date: | Sat, 03 Aug 2002 07:45:09 +0000 |
| Subject: | PEAR::DB and Smarty | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-5567@lists.php.net to get a copy of this message | ||
Hi.
I'm using PEAR::DB with Smarty and I have trouble looping the results
from the db in the template files.
This is from index.php:
<code>
while ($newsRow = $newsResult->fetchRow(DB_FETCHMODE_ASSOC)) {
$_SMARTY->assign("NEWSID", $newsRow['newsId']);
$_SMARTY->assign("NEWSTOPIC", $newsRow['newsTopic']);
$_SMARTY->assign("NEWSDATE", $newsRow['newsTopic']);
$_SMARTY->assign("NEWSSYNOPSIS", enable_url($newsRow['newsSynopsis']));
}
</code>
and this is how I try to loop the results in index.tpl.htm:
<code>
{section name=news loop=$newsRow}
{$NEWSID}<br>
{sectionelse}
There are no values in $newsRow
{/section}
And it prints 'There are no values in $newsRow'.
Help please :-)
Sincerely,
Eskil Kvalnes
eskil@uten.net