Smarty Loop Question
Posted: Mon Apr 25, 2005 10:07 am
Okay I've got a db call that retrieves an associative array:
Outputs this:
Assigned to smarty like this:
Template implementation:
I don't get any output with this at all. Does anybody know how to correctly loop through the above array using Smarty?
**This post previously listed under general discussion -- Sorry folks, it must be Monday
**
Code: Select all
$articles = $db->GetAssoc($sql);
print_r($articles);Code: Select all
Array
(
ї158] => Array
(
їarticle_id] => 158
ї0] => This string
їarticle_title] => This String
ї1] => This String
їarticle_short] => Another String
ї2] => Some Picture
їarticle_picture] => Some Picture
ї3] => 1
їarticle_active] => 1
)
ї157] => Array
(
їarticle_id] => 158
ї0] => This string
їarticle_title] => This String
ї1] => This String
їarticle_short] => Another String
ї2] => Some Picture
їarticle_picture] => Some Picture
ї3] => 1
їarticle_active] => 1
)
}Code: Select all
$smarty->assign('articles', $articles);Code: Select all
{section name=i loop=$articles}
<p>{$articlesїi].article_id}
{$articlesїi].article_title}</p>
{/section}**This post previously listed under general discussion -- Sorry folks, it must be Monday