Pages

Monday, December 5, 2011

Creating an application specific library for application developed using Zend Framework



                I just wanted to do this when I tried to implement link exchange application using Zend Framework to understand the usage of Zend.
Here is what I wanted to do,
Create an Acl plugin and put it in a folder inside the library folder. Path from the application folder in www directory is as follows

linkdir/library/Linkdir/controller/plugin/Acl.php

in order to identify the this plugin by frame work I needed to add its name space to autoloader. If you are trying to do the same solution is here. Otherwise you are at the wrong place and this won’t be of any use for you.

Here is how I did it
I added the following line on the applicatioin.ini file

autoloaderNamespaces[] = "Linkdir_"

Since I added the name space my class name also needed to reflect the name space. Therefore the class name should look like something following

Linkdir_Controller_Plugin_Acl

Folder names are separated using ‘_’ .
There might be a way to do this by overriding  _initAutoload() method in the bootstrap.php file in the application folder.