My_View extends Zend_View
{
protected $_myvariable;
function __construct()
{
$registry = Zend_Registry::getInstance();
$this->_myvariable = $registry->_myvariable;
}
}
-- Best regards, Cristian Bichis www.zftutorials.com | www.zfforums.com | www.zftalk.com | www.zflinks.com
I think registry would work fine for forms and action controllers but what about views. I will need to assign an object to a view each time I need it. My main purpose is to automate the object access throughout the application and avoid coding accessing the registry or assigning the object to the view. I want all these things to be done automatically. On Fri, Feb 13, 2009 at 5:22 AM, Matthew Weier O'Phinney <matthew@zend.com> wrote:-- Kostyantyn Shakhov <kshakhov@gmail.com> wrote (on Friday, 13 February 2009, 02:23 AM +0200):What's the best way to make objects available "globally"? I mean available in the following: 1) In action controllers; 2) In Forms; 3) In Views; Sure I can use registry and then assign these objects to the views and/or forms in action controllers but what if I want to make these objects automatically assigned to ALL action controllers, views and forms in the project?That's what a registry does -- you assign once, and pull out from anywhere... -- Matthew Weier O'Phinney Software Architect | matthew@zend.com Zend Framework | http://framework.zend.com/
没有评论:
发表评论