Quantcast

Non-core contribution: Zend_Autoload

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Non-core contribution: Zend_Autoload

Ralph Schindler
I don't think this function offers much to the core but perhaps someone
might find some use in this.  I've been using this for a while to
include my models (from my RelationalObjectMapper models) as well as
other non-core includes.  When Zend_Cache becomes more stable, usable..
I plan on adding auto class caching functionality to hopefully increase
performance .. if need be.

NOTE: Zend_Config below is my simple parse_ini_file wrapper.


http://www.ralphschindler.com/Zend_Framework_Modules/Zend_Autoload/Autoload.phps

here is how i use it:

index.php
<?
// Set the include path to Zend
set_include_path(get_include_path().PATH_SEPARATOR."../application/lib/");

// load the autoload class
require_once("Zend/Autoload.php");

// start the autoloader
Zend_Autoload::init();

// set the config directory
Zend_Config::setConfigDirectory("../application/config/");

// add the paths that should be considered when autoloading
foreach (Zend_Config::getItem("framework.ini", "autoload") as
$autoload_path)
     Zend_Autoload::addAutoloadPath($autoload_path);

... rest of index.php - no more need for any requires/includes ...

Loading...