Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

PHP & Smarty Templates

silverCoder909silverCoder909 Posts: 1Member
I have my class

class Announcement
{
public $ID;
public $info;

public function __construct() { }
}

I use mysqli to interface with my database and create an array of objects

$result = array();
while( $row = $some_sth->fetch_object() )
{
$tmp = new Announcement();
$tmp->ID = $row->ID;
$tmp->info = $row->info;
$result[] = $tmp;
}
$tpl->assign('result',$result);

I want to output this array of objects in my smarty template but I cannot seem to figure out how. Any help would be appreciated.

Note:
-DB access is not the problem; I can echo out the array of objects just fine and output is as expected.

-smarty setup/configuration is fine. I can assign other variables and they display just fine.

Again, if anyone can help me get the array of objects to output in smarty, I'd really appreciate it.


Comments

Sign In or Register to comment.