Skip Navigation LinksHome > Categories > Code from a Category

Customize autoload library in Zend Framework 1.8



User Name: serfcompany
Name: Serf
Contact Me: www.datawebcoder.com
Home Page: www.datawebcoder.com
php,mysql,javascript,html,css. Preferable working with Zend Framework. Good know javascript. I worked with various, javascript frameworks such as(jquery, YUI3, extjs, sencha touch). [More]
Viewed Times: 173
Add Date: 01/31/2012
In this small article we consider how to load your library in Zend Framework

To download the Zend Framework their libraries, we need to do the following:

First - this is to add the physical path to the library in include_path.

Second - this is the prefix class library, if such is generally used.

Add the path to the include_path in two ways:

1. Hard-coded path to public / index.php file:



2. Set the path to the file konfigruatsionnom application / configs / application.ini



In both cases we add the path to mylib the include_path. The second method is more preferable, since on the basis of the chosen configuration (production, development, test) You can set the path to the different versions mylib. By the way using the same technique, you can set the path to the directory and library / Zend and load configurations on the basis of different versions of Zend Framework.


And so, the second that we need to do - is to connect the autoloader and set the prefix used by the classes of the library. I ordered the autoloader in the file public / index.php




In this case, the prefix classes in my library "My_".

Also, this same code can be assigned in class Bootstrap.php



All ZF now knows how to load classes from your library.

Post a Comment

Name: (Optional)
Email: (Optional, you can get an email if somebody replys your comments)*
Email me if somebody respons my comment below:
Details**:
Enter Text
as Below:
(case insensitive, if hard to read, click the "get a new one" button)
 
    
* Your email address will not be shared with any third parties for any reason.
** Maximum 1000 charactors.