Hi,

No, there isn't any way to do that. But you can use Zend_Registry to register some global classes.

You can use it this way:

$site_sess = new Zend_Session_Namespace('my_session');

$site_sess->hello = 'what do you want?';

Zend_Registry::set('site_sess', $site_sess);

// in your controller:
$site_sess = Zend_Registry::get('site_sess');

Zend_Debug::dump($site_sess->hello);

Mostly, I am using Zend_Registry for my configuration, but you can store any kind of data in it.

river_jetties schreef:
I have a bootstrap file with the following:

$site_sess=new Zend_Session_Namespace('my_session');
$site_sess->hello='what do you want?';

I want to have session variables available throughout controllers and model.
It seems like whenever I need to access them I need to do somethinkg like
the following in each controller function:

    public function homeAction(){
        $site_sess=new Zend_Session_Namespace('my_session');
         echo "<pre>\$site_sess:";
         print_r($site_sess->hello);
         echo "</pre>";
    }

Is there any way to just make $site_sess global to all models and
controllers via configuration? It seems like a lot of wasted typing.
--
Regards,

Pieter Kokx
MaakSite.nl Productions
PHP Developer


Reply via email to