Re: [SMARTY] DB_DataObject and Smarty

From: Date: Fri, 06 Oct 2006 01:09:15 +0000
Subject: Re: [SMARTY] DB_DataObject and Smarty
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-13493@lists.php.net to get a copy of this message
Yes, you probably do need to implement the iterator interface in the users class. I believe that Smarty uses foreach loops for all iteration so that objects with iterator interfaces can be used. You should also get the same error/result if you were to add the following to sandbox.php: foreach( $users as $user ) { echo "Current User: ".$user['id']."<br>"; }
Well, I was able to use MDB2_Iterator as my iterator. After instantiating and initializing it, I'm able to iterate through it fine using straight PHP (similar to the above code), but I can't get it to work in Smarty. I no longer get the error (using ->register_object() but I do get it using ->assign()) but now it's not displaying anything; it doesn't appear that Smarty is iterating through anything. Is there something I'm missing? thnx, Chris

« previous php.smarty.general (#13493) next »