I have following code in my bootstrap
protected function _userSession(){
$session=new Zend_Session_Namespace("userIdentity");
$session->greet="Hello!!!!!";
Zend_Registry::set("session", $session);
}
And in controller I write:
public function index() {
$session = Zend_Registry::get("session");
echo $session->greet;
}
But it will showing the error message like: No entry is registered for key ‘session’. Whats wrong with this code. Any solution.
I think you just need to change the bootstrap method for user session to
_initUserSession()Depending on how you set things up, the bootstrap will automatically call all methods that start with
_initSee here: http://framework.zend.com/manual/en/zend.application.theory-of-operation.html#zend.application.theory-of-operation.bootstrap.resource-methods
If you have the default
index.phpused by zend, then your bootstrap will automatically call all methods that start with_initSo if you have something like the following:
$application->bootstrap()->run();But if you do something like this:
The above will only call the init methods for the ones listed in your array.