Re: DB_DataObject and Smarty
| From: | arnaud sellenet | Date: | Fri, 06 Oct 2006 15:13:09 +0000 |
| Subject: | Re: DB_DataObject and Smarty | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-25363@lists.php.net to get a copy of this message | ||
You need to register a smarty block in order to use it with DBDO.
See http://demental.info/blog/index.php/?q=smarty
Le 5 oct. 06 à 02:38, Chris Boget a écrit :
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 --PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php