Re: {section} with MySQL Data
| From: | Tom Sommer | Date: | Sat, 12 Apr 2003 18:18:12 +0000 |
| Subject: | Re: {section} with MySQL Data | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9225@lists.php.net to get a copy of this message | ||
On Sat, 12 Apr 2003 20:04:56 +0200, Leliel wrote:
> Hi,
> I would like to use a Smarty {section} with MySQL Data.
> The data is beeing fetched by mysql_fetch_array() and
> assigned to smarty, but the section in the template
> does only displays garbage. Only the first letter of
> each dataset.
> That's the code:
> {section name=news loop=$newsdata}
> {$newsdata[news].text}
> {/section}
> whats wrong??
> echo $newsdata['text']; works fine ...
Have you done it like so
while ($rs = mysql_fetch_array($sql) )
{
tmp[] = $rs;
}
$smarty->assign('newsdata', $tmp);
--
Tom Sommer, Denmark
www.tsn.dk - www.dreamcoder.dk