section problem
| From: | Esteban Fernandez | Date: | Fri, 20 Jun 2003 15:42:45 +0000 |
| Subject: | section problem | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-9746@lists.php.net to get a copy of this message | ||
Hi there
I think this is a very basic question, but i'm newbie in Smarty, i hope
someone can help me. I try list all the content in a table called "news",
this display news of cource in the main page, well that's the main idea..
I have this PHP code:
[php]
$link = db_connect();
$result = mysql_query("SELECT * FROM news WHERE news_status LIKE 1 ORDER BY
news_date ASC");
while ($row = mysql_fetch_array($result)) {
$smarty->assign("row", $row);
}
$smarty->display("news.tpl");
[/php]
And my Smarty code
{secion name=news loop=$row[0]}
Title: {$row[1]}<br>
Content: $row[2]}<br>
{/section}
The problem: i have 5 != news in the table, but the Smarty list the just the
last new in 5 times!, how can i resolv this problem ?. Comments and suggest
are welcome.
Thanks in advanced.
EF.