i created a model object in PHP
class User {
public $title;
public function changeTitle($newTitle){
$this->title = $newTitle;
}
}
How do i expose the property of a User object in smarty just by assigning the object?
I know i can do this
$smarty->assign('title', $user->title);
but my object has something like over 20 plus properties.
Please advise.
EDIT 1
the following didn't work for me.
$smarty->assign('user', $user);
OR
$smarty->register_object('user', $user);
then i try to {$user->title}
nothing came out.
EDIT 2
I am only currently trying to output the public property of the object in the smarty template. Sorry if i confused any one with the function.
Thank you.