PHP Classes

File: BootStrap

Recommend this page to a friend!
  Classes of Steve Winnington   Autoloader with MVC in mind   BootStrap   Download  
File: BootStrap
Role: Example script
Content type: text/plain
Description: Example of BootStrap for Class
Class: Autoloader with MVC in mind
Autoload classes from common directories
Author: By
Last change:
Date: 11 years ago
Size: 1,001 bytes
 

Contents

Class file image Download
<?php

define
('DS', DIRECTORY_SEPARATOR);
define('ROOT', dirname(__FILE__));


/// MVC FOLDERS ////
/*
My Example Structure

/lib/control_custom/
/lib/control/
/lib/model/dao/
/lib/model/vo/
/lib/view_custom/
/lib/view/

*/

define('CONTROL_CUSTOM', ROOT.DS.'lib'.DS.'control_custom'.DS );
define('CONTROL', ROOT.DS.'lib'.DS.'control'.DS );
define('MODEL_DAO', ROOT.DS.'lib'.DS.'model'.DS.'dao'.DS );
define('MODEL_VO', ROOT.DS.'lib'.DS.'model'.DS.'vo'.DS );
define('MODEL_FORMS', ROOT.DS.'lib'.DS.'model'.DS.'forms'.DS );
define('VIEW', ROOT.DS.'lib'.DS.'view'.DS );
define('VIEW_CUSTOM', ROOT.DS.'lib'.DS.'view_custom'.DS );

///////AUTO LOADING CLASSES////////////
require_once(ROOT.DS.'lib'.DS.'HelperClasses.php');

/*

Now you should be able to load any class automatically and get the accociated view.

I keep my core files in the control and view folders and any custom modifications from standard go into the _custom folders which are not updated.

*/