Quick guide to DooSession


This will be a quick guide how to use DooSession, first of all you need to call a DooSession class, I love to have one super class that extends DooController class. In super class constructor I make session and create everything I need for a website.

Calling session class needs one parameter and thats namespace name, often you wish to put name for your session.

1.
$this->_application = Doo::session(“mywebsite”);
Now that you created session namespace you can start using it, storing in session and getting stuff from it. For example you want to define username of user that is registered:

1.
$this->_application->user = “John”;
Now you are accessing it from controller with:

1.
$this->_application->user
Another nice thing is to have access to session from your view scripts, I am doing it like this, inside constructor of my super class I add:

1.
$data[‘application’] = Doo::session(“mywebsite”);
2.
$this->renderc(‘templatefile’, $data);
Now from your view scripts you can access your user variable like:

1.
$this->data[‘application’]->user
Thats about it, all functions that you have in doo session class are in API.

Previous PostNextNext Post

Leave a Reply

Your email address will not be published.