Session handling was one of the boring topic in plan php atleast for me, but in Zend Framework it really shines. If you like to work with Object oriented programming, you will definitely become fan of it.
In this article I’m going to discuss some useful techniques of using Zend Framework Session and Session namespace.
Keep in mind that Both Zend_Session and Zend_Session_Namespace extends abstract class Zend_Session_Abstract. So both inherit methods avaliable in Zend_Session_Abstract automatically.
If you want to go under the hood, you can open Zend/Session/Abstract.php and have a look at the functions available.
Instead of delve into the function available, I’d rather discuss some useful techniques.
“Read full article here”, http://zendgeek.blogspot.com/2009/07/zend-framework-session-usage-and.html
Also some action helper can be usefull:
require_once 'Zend/Controller/Action/Helper/Abstract.php';
require_once('Zend/Session.php');
class My_Action_Helper_Session extends Zend_Controller_Action_Helper_Abstract
{
public function direct($namespace = 'Default')
{
return new Zend_Session_Namespace($namespace);
}
}
Can be called in controllers
$this->_helper->session()->foo = 'bar';
or
$this->_helper->session('Zend_Auth')->expiration = 3600;
Thanks a lot , it was a great help … specially since we dont get good help/example anywhere on Zend framework , if u know some really good link where i can find most of the class/function list with there respective example , pls let me know
you can find lots of useful resources here
http://robertbasic.com/blog/online-resources-for-zend-framework/