sasori
sasori

Reputation: 5445

Zend_Session::start() in bootstrap

can you tell me how to include the Zend_Session::start() in a bootstrap file of zf app?

Upvotes: 1

Views: 5352

Answers (1)

Phil
Phil

Reputation: 164731

Use the application resource - http://framework.zend.com/manual/en/zend.application.available-resources.html#zend.application.available-resources.session

All you need to do is provide a "session" section in your config file "resources" section.

At a minimum, I'd recommend setting a session name, eg

resources.session.name = "MyAppName"

or if using Zend_Config_Xml

<resources>
    <session>
        <name>MyAppName</name>
    </session>
</resources>    

If you want to do some session stuff in your Bootstrap class, just make sure you bootstrap the session resource first to pick up your configuration options, eg

protected function _initSessionNamespaces()
{
    $this->bootstrap('session');

    // now create your namespace(s) and whatnot
}

Upvotes: 7

Related Questions