Login   Register  
PHP Classes
elePHPant
Icontem

File: example

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Dave Hale  >  Basic Auto-loader  >  example  >  Download  
File: example
Role: Example script
Content type: text/plain
Description: Brief example of using the class
Class: Basic Auto-loader
Register auto-loader for classes defined in arrays
Author: By
Last change:
Date: 1 year ago
Size: 1,218 bytes
 

Contents

Class file image Download
<?php

//use statement to match class namespace declaration 
use dho\mvc\autoloaders\BasicAutoloader;

// define dho directories
defined 'DOC_ROOT' ) || define 'DOC_ROOT'dirname $_SERVER ['DOCUMENT_ROOT'] ) . "/" );
defined 'DHO_BASE' ) || define 'DHO_BASE', (DOC_ROOT "dho/" ));
defined 'DHO_CLASSES' ) || define 'DHO_CLASSES', (DOC_ROOT "dho/" ));
defined 'WEBSITE_MVC_DIR' ) || define 'WEBSITE_MVC_DIR',( DOC_ROOT 'website_mvc_dir/') );

//can name your own log file directory before class is called
defined "DHO_LOGS" ) || define "DHO_LOGS", (DOC_ROOT "dho_logs/") );

//need to include the BasicAutloader.php class file as no autoloader registered yet
require_once (dirname $_SERVER ['DOCUMENT_ROOT'] ) . '/dho/mvc/autoloaders/BasicAutoloader.php');


//register the base paths only so they are checked first
BasicAutoloader::register ( array ( "DHO_CLASSES" => DHO_CLASSES,  "WEBSITE_MVC_CLASSES" => WEBSITE_MVC_DIR."classes/" ), FALSE); 


//register the dirs and all sub directories. - will append to previous call
BasicAutoloader::register ( array ( "DHO_BASE" => DHO_BASE,  "WEBSITE_MVC_DIR" => WEBSITE_MVC_DIR,"CMS_DIR" => "c:/wamp/cms/" ), TRUE);