trouble with arrays in template
| From: | Erich Beyrent | Date: | Wed, 23 Jul 2003 01:39:15 +0000 |
| Subject: | trouble with arrays in template | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-9943@lists.php.net to get a copy of this message | ||
Hi there,
I am trying to pass in the following array to my template:
$gallery_dir = $DOCUMENT_ROOT.'/photos/gallery/';
$smarty->assign('PhotoArray',
array('link' => $gallery_dir.'yellow/Bikes0.jpg'),
array('link' => $gallery_dir.'yellow/Bikes1.jpg'),
array('link' => $gallery_dir.'yellow/Bikes2.jpg'),
array('link' => $gallery_dir.'yellow/Bikes3.jpg'),
array('link' => $gallery_dir.'yellow/Bikes3.jpg'),
array('link' => $gallery_dir.'yellow/Bikes3.jpg')
);
And then in my template, loop through them:
<!-- Template code -->
<table border="0" cellspacing="0" cellpadding="5">
{section name=i loop=$PhotoArray}
<tr>
<td><img src="{$PhotoArray[i].link}"</td>
</tr>
{/section}
</table>
However, none of the images are loading, and none of the template code
is showing up at all.
What have I done (or not done), and how do I fix it?
Thanks for your help!
-Erich-