Homepage
I, Me and Myself
Portfolio
Mindfolio
Blog
Guestbook

Navig: Blog > Zend Framework

Post 9: Managing application.ini and session data in Zend Framework

Posted on February 09, 12 @ 07:05 am under Zend Framework.

A. Accessing application.ini data
There will be times when configuration items are needed in the logic. There is a way you can access it.

This line can be given in init() of the controller.
$this->_config = $this->getInvokeArg('bootstrap')->getOptions();


Now the config data is available as array for controllers.
_____________________________________________________________________________________


B. Accessing session data.
Session data is available as class members by instantiating session namespace.

For easiness,
1. the session namespace can be specified in the application.ini. and can be called in the code.
2. as an alternate, instead of calling many times, in init(), you can instantiate a class member variable, which will be available for the controller.

$this->_session = new Zend_Session_Namespace($this->_config['sessionName']);


_____________________________________________________________________________________

C. Making session data available for view.
In init() of controller, you can add following line, after the above line.
$this->view->sessionData=$this->_session;

Comments

No comments.

•   Databases (6)
•   Diary (117)
•   HTML and Javascript (2)
•   For Your Information (18)
•   iSpecial Jokes (13)
•   Java related (1)
•   Javascript (1)
•   Jokes (41)
•   Mind Views (22)
•   My Observations (8)
•   Open Source Tech. (7)
•   PHP (6)
•   My Poetry (10)
•   Reviews (2)
•   Sing Along (21)
•   Sankaracharya Stotras (3)
•   My Talent (1)
•   Uncategorized (27)
•   Webservers (3)
•   Websites to see (28)
•   WML and WAP (3)
•   Zend Framework (10)

•   It is my personal site. Content included here is according to my wish. If you don't like my site, close it and go away.
•   'Mind Views' and 'My Observations' are purely opinions of mine and not others. If something in this site hurts you, control
     your mind and send me a mail. We will discuss. If you go to court of law, it's your wish. Every citizen has a right to express, so do I.
•   Some content in this site might not be appropriate for some audience, whose opinions differ with me. So don't try to argue with me.
•   Important: Don't try to judge me just by glancing this website. I am different outside.
•   This is a time-pass site. Reading it in a hurry will be useless.