[SMARTY] DB_DataObject and Smarty

"Chris Boget" <[email protected]> Thu, 5 Oct 2006 14:30:29 -0400
Newsgroups gmane.comp.php.smarty.general
Message-ID <[email protected]>
Does anyone know of any tutorials out there that show how I can get smarty 
working with DBDO?  I've searched but haven't been able to come up with 
anything beyond using DB::getAll() method.  I'd rather stay away from using 
that if at all possible. I'd rather use DBDO::find().  Here's one (among 
many) attempt I made to get it to work:

sandbox.php:
<?php
  $users = new Users();
  $users->country = 'USA';
  $users->limit( 10 );
  $users->find();

  $smarty = new Smarty();
  $smarty->assign( 'users', $users );
  $smarty->display( 'sandbox.tpl' );

?>

sandbox.tpl
<html><head><title></title></head><body>
{section name=bar loop=$users}
  Current User: {$users[bar].uid}<br>
{/section}
</body></html>

but doing that gives me an error saying that it cannot use object of type 
Users as array.  Am I just doing it wrong?  Do I need to implement the 
iterator interface in the Users class?

If someone can offer any pointers as to what I'm doing wrong or if you can 
point me to a howto/tutorial on the web, that'd be awesome!

thnx,
Chris 

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php