Config.php
<?php /* ******************************************* |Sciezki do MVC libraries/plugins/components * ******************************************* */ $configs['PathControllers'] = 'controllers/'; $configs['PathModels'] = 'models/'; $configs['PathViews'] = 'views/'; $configs['PathLibs'] = 'libraries/'; $configs['PathPlugins'] = 'plugins/'; $configs['PathModules'] = 'components/'; $configs['PathConfig'] = 'config/'; /* ******************** |Ustawienia ogolne * ******************** */ $configs['controller'] = 'Home'; //Default controller $configs['action'] = 'Index'; //Defualt action $configs['render'] = true; //Render = true bez echo $configs['debug'] = 2; /* ******************** |Dane do bazy danych * ******************** */ $configs['host'] = '***'; $configs['login'] = '****'; $configs['pwd'] = '****'; $configs['db'] = '***'; return $configs; ?>
I klase import:
<?php require_once('libraries/Loader.php'); class Imports { /* private $PathImports = array( $cfg -> PathControllers, $cfg -> PathLibs, $cfg -> PathModels, $cfg -> PathModules.$cfg -> PathControllers, $cfg -> PathModules.$cfg -> PathModels, $cfg -> PathModules.$cfg -> PathViews, $cfg -> PathPlugins.$cfg -> PathControllers, $cfg -> PathPlugins.$cfg -> PathModels, $cfg -> PathPlugins.$cfg -> PathViews, $cfg -> PathConfig ); */ public function __get($class) { foreach($this -> PathImports as $key => $imports) { require_once($imports.$class.'.php'); } require_once($imports.$class.'_Model.php'); } } if(class_exists($class) || class_exists($class.'_Model')) $obj = new $class(); return $obj; } } ?>
Gdy w polu PathImports dam sciezki czyli controllers,models etc to dziala jednak nie wiem jak zrobic zeby ladowalo je odrazu do tej tablicy i dzialalo mam nadzieje ze wiecie o co mi chodzi.