Object Loading Mechanism
All systematicly implemented objects in the Framework can be loaded with just
one function call. For example:
$tpl = &loadObject('ctl.tpl');
This function is defined in file ./system/lib/ctl/ctlObjectLoader-php4.flib.php.
What happens when calling the function is this:
- If an object with the same object full name is found in global array $modules, it is returned at once.
- If no object yet exists with the same object full name:
- The function searches for loading config for the object in global $modconfig variable (e.g.
$modconfig['ctl.tpl']['load']
).
- The function also searches if there is a global module loading config (e.g.
$modconfig['ctl']['load']
).
- If the loading config is not found it is assumed one of the following:
- there exists a global function for the module called modulename_loader() that is defined in file ./system/modules/modulename/modulename_loader.php
- there exists a class `Objectname` for the object, defined in: ./system/modules/modulename/Objectname.class.php
- there exists a class `Modulename` for the module, defined in: ./system/modules/modulename/modulename.class.php
- If the loading config was guessed by the system it is filled into global $modconfig array. Also the system assigns $config array values with corresponding names to
$modconfig['mod.obj']['config']
variable.
- When the class/function file is found. It is called and an object is created and returned.
All _loader() functions and object classes should take two parameters:
$obj_fullname
string.
$config
array.