The now deprecated Zend.php file used to need to be included in the bootstrap and that was where Zend::registry() was coming from. You don't specify where you are getting that error but I suspect you've not actually included the Zend_Registry file...

include 'Zend/Registry.php';

...in your bootstrap.

Besides that, I'd really recommend from what you outline below that you simply pass the $view object as a parameter to the controllers:

In bootstrap...

$view = new Zend_View();
$view->setScriptPath('../application/views');

...then as part of setting up your controller...

$controller->setParam( 'view', $view )

...and then retrieve that in your index controller...

$view = $this->getInvokeArg('view');

Nick


WHen I do this in my boot-strapper:
                Zend_Loader::loadClass('Zend_View');
                $view = new Zend_View();
                $view->setScriptPath('../application/views');
                Zend_Registry::set('view',$view);       

and this in my default index controller:

$view = Zend_Registry::get('view');

it gives me an error:
Fatal error: Class 'Zend_Registry' not found

and I have to reinstantiate the view in the controller to get this to work.
This is not right.




Nick Lo-2 wrote:

Zend_Registry::set('config',$config);
Zend_Registry::get('config');

http://framework.zend.com/manual/en/zend.registry.html

Also if you're just using that config in a controller you may like to
use...

$controller->setParam( 'config', $config )

...and retrieve that in the controllers with something like...

$this->_config = $this->getInvokeArg('config');

Nick

On 19/03/2007, at 4:34 PM, ZegeeDotCom wrote:


Can someone give me an example of how I use the zend registry. I
upgraded to
ZF 0.9 and my zend registry is not working.

here is the code in my bootstrap file:

function bootstrap(){

                include "Zend/Loader.php";    
                Zend_Loader::loadClass('Zend_Controller_Front');
                Zend_Controller_Front::run('../application/controllers');
                
                Zend_Loader::loadClass('Zend_Registry');
                Zend_Loader::loadClass('Zend_View');
                $view = new Zend_View();
                $view->setScriptPath('../application/views');
                Zend_Registry::set('view',$view);               
                
                Zend_Loader::loadClass('Zend_Config_Ini');      
                $config = new
Zend_Config_InI('../application/config/config.ini','general');
                Zend::register('config',$config);                               
        
}

How do I register and "deregister" my registers? ;)


--
View this message in context: http://www.nabble.com/unclear-example-
of-using-of-zend-registry-tf3425165s16154.html#a9546793
Sent from the Zend Framework mailing list archive at Nabble.com.





--
View this message in context: http://www.nabble.com/unclear-example- of-using-of-zend-registry-tf3425165s16154.html#a9547312
Sent from the Zend Framework mailing list archive at Nabble.com.


Reply via email to