Back to Blog
Dotkernel

Zend Registry usage in DotKernel

In DotKernel, Zend_Registry will contain the following variables:
  • startTime - the result of microtime() at the beginning of the request
  • configuration - the configuration options loaded from configs/application.ini
  • router - routing settings loaded from configs/router.xml
  • database - the database adapter
  • settings - the settings loaded from the database
  • requestModule, requestController, requestAction - the module, controller and action of the current request
  • request - additional request variables
  • seo - seo information loaded from configs/dots/seo.xml (site name, default description, keywords etc)
  • option - the options for the current dot loaded from configs/dots/<moduleName>.xml
  • session - the session object
To use the variables in the registry, you must first get an instance of the registry object:
>$registry = Zend_Registry::getInstance();
//...
echo $registry->startTime;
//...
echo $registry->requestAction;
Or if you only need one variable from the registry, you can get it directly using:
>$action = Zend_Registry::get('requestAction');
You can find more information about Zend_Registry, in the Zend Framework Documentation.