View Single Post
Old 05-10-2009, 05:19 PM   #16 (permalink)
allworknoplay
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

Thanks WH:

I like this design by Zend too....based on the code below, all it seems to do (other than correctly create the name of the file) is to "include_once" when the main script needs to call a class right?


PHP Code:
function __autoload($szClassName)
{
    
$szFilePath str_replace('_''/'$szClassName) . '.php';
    include_once(
$szFilePath);


As oppose to this:

PHP Code:
include_once("includes/database.php");
include_once(
"includes/login.php");
include_once(
"includes/member.php");
include_once(
"includes/validation.php");
include_once(
"includes/pagination.php"); 

So with the latter, it calls everything, everytime, and the former, it only calls when called upon...hence lazy loading...


Is that correct?

Also you wrote:


new Core_Exception();
new Core_Database_Row();



Is that something specific to the Zend Framework? Do I need to call them too? Or were you just providing generic example of instantiating a class...
allworknoplay is offline  
Reply With Quote