Пример #1
0
<?php

require_once 'config.php';
require_once 'Controllers/HomeController.php';
require_once 'libs/Database/Database.php';
require_once 'libs/utils/utils.php';
$action = $_REQUEST['action'];
if (!empty($action)) {
    require_once 'Controllers/' . $action . 'Controller.php';
    $actionController = $action . 'Controller';
    $instance = new $actionController($_REQUEST);
    $instance->process();
} else {
    $_REQUEST['action'] = 'Home';
    $instance = new HomeController($_REQUEST);
    $instance->process();
}
Пример #2
0
////ALWAYS SET THIS TO 'FALSE' BEFORE DEPLOYING
/** AutoLoad class files as soon as needed ***/
spl_autoload_register('loadClass');
include_once CONFIG . 'settings.php';
$registry = new Registry();
Factory::getRegistry($registry);
Factory::getParameters($parameters);
//parameter is defined in the settings file
// URI will always be of the form /specific_path
$request = $_SERVER["REQUEST_URI"];
$path = explode("/", $request);
$controller_obj = null;
switch ($path[1]) {
    case '':
        $controller_obj = new HomeController($path, $registry);
        $controller_obj->process($_POST);
        break;
    case 'admin':
        $controller_obj = new AdminController($path, $registry);
        $controller_obj->process($_POST);
        break;
    case 'categories':
        $controller_obj = new CategoriesController($path, $registry);
        $controller_obj->process($_POST);
        break;
    case 'contact':
        break;
    case 'profile':
        $controller_obj = new ProfileController($path, $registry);
        $controller_obj->process($_POST);
        break;