close
Phork Manual Table of Contents
Phork Framework User Guide 1.3.4

CoreLoader

Filepath: phork/php/core/CoreLoader.class.php and phork/php/app/AppLoader.class.php

The CoreLoader class is used to include the various other classes that make up the application, and optionally to instantiate an object from an included class. There are several wrapper classes to include the most common class types. They are includeController(), includeModel(), includeHook(), includeExtension, and includeUtility().

The loader checks for the file in all the include paths set by set_include_path() in the front controller.


Example

//get the full include path to the public templates
AppLoader::getIncludePath('sites/public/templates/');

//include the database factory from the database directory
AppLoader::includeClass('php/database/', 'DatabaseFactory');

//include the site controller
AppLoader::includeController('SiteController');

//include the user model
AppLoader::includeModel('UserModel');

//include the common hooks
AppLoader::includeHooks('CommonHooks');

//include the debug log extension class
AppLoader::includeExtension('debug/', 'DebugLog');

//include the token utility class
AppLoader::includeUtility('Token');

//include and instantiate the file system handler
$objFileSystem = AppLoader::newObject('php/ext/files/', AppConfig::get('FileSystem') . 'FileSystemHandler');