Autoloader
LEPTON-CMS comes up with a autoloader function, basicly for the internal (core) functionalityand mainly for modules for there own functionalyties.
The basic syntax for own module classes is
.php
inside the modulesdirectory:
~//classes/.php
Example given:
Assumee the LEPTON module is named "display_code", then
the autoloader is looking for a class-defination inside
~/modules/display_code/classes/display_code.php
Combinations with sub-themes
are possible:
display_code_interface(.php)
display_code_parser(.php)
display_code_superglobals_combinations(.php)
The LEPTON-autoloader is still looking inside "display_code/classes/" for theese files.
example
module: lib_twig
file: ~/modules/lib_twig/classes/lib_twig.php
class lib_twig { /** * Registers Twig_Autoloader as an SPL autoloader. * * @param bool $prepend Whether to prepend the autoloader or not. */ public static function register($prepend = false) { // class goes on here }
call inside module/template;
// Use the internal LEPTON autoloader lib_twig::register();