| Tim Lucas 2004-07-07, 8:59 am |
| I want to pass an object which is a composite of objects to my smarty
template and be able to be access the nested object.
For example:
{$gallery->getPicture()->getTitle()}
A simplified version of my object is as such:
class SVGallery
{
var $_picture;
function SVGallery(&$picture)
{
$this->setPicture($picture);
}
function setPicture(&$picture) { $this->_picture = &$picture; }
function &getPicture() { return $this->_picture; }
}
My php does the following:
$smarty->assign_by_ref('gallery',$oGallery);
The smarty debug output shows the nested objects fine, I just can't
access them using the template syntax.
I've tried assigning the object to a template var and running the
method, but that does not work either.
I've found this same question on the FAQ with no answer:
http://smarty.incutio.com/? page=Sm...p
late-17
Any ideas aside from converting all my objects into nested associative
arrays, which, although it would reduce coupling between model and view,
I don't particularly need in this situation.
-- tim
http://www.toolmantim.com
|