Accessing object trough a loop
| From: | Rémy Dufour | Date: | Mon, 24 Mar 2003 15:59:18 +0000 |
| Subject: | Accessing object trough a loop | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-8864@lists.php.net to get a copy of this message | ||
Hi Folk !
I've recently switched from PHPLIB template to Smarty and uptodate, i really enjoy it !
I have one question .. is there a way to access Object in a section loop ?
Here is my template
...
<p>
{section name='searchResult' loop=$MyArray}
{$MyArray[searchResult].someObject->someMethod()}<br>
{/section}
</p>
...
Here is my code
...
while ($db->fetchRow()) {
$rs[] = array(
"someObject"=>$db
);
}
$Smarty->assign_by_ref("MyArray", $rs);
...
Im using Smarty 2.5.0 RC1 !
Regards !
Rémy Dufour