Re: [SMARTY] DB_DataObject and Smarty
> 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
|