コード例 #1
0
 /**
  * Construct the (base) controller. This happens when a real controller is constructed, like in
  * the constructor of IndexController when it says: parent::__construct();
  */
 protected function __construct()
 {
     // create a view object to be able to use it inside a controller, like $this->View
     $this->View = View::load();
     // create a app object to be able to use it inside a controller, like $this->App
     $this->App = App::load();
 }
コード例 #2
0
use WebSupportDK\PHPSecurity\Session;
define('APP_LOCALE', $app->get('config.app.locale'));
define('APP_CHARSET', $app->get('config.app.charset'));
// Set default locale
Session::set('locale', APP_LOCALE);
// Set session locale
if (Cookie::exists('locale')) {
    $app->set('messages', require APP_LANG . Cookie::get('locale') . '/messages.php');
} else {
    $app->set('messages', require APP_LANG . Session::get('locale') . '/messages.php');
}
/*
 * Set View
 */
use WebSupportDK\PHPMvcFramework\View;
$app->set('View', View::load());
$app->get('View')->setTemplatePath(APP_VIEW);
$app->get('View')->setFeedbackFile(APP_VIEW . 'layouts/feedback');
/*
 * Set Cache
 */
use WebSupportDK\PHPFilesystem\Cache;
if ($app->get('config.cache.status')) {
    $app->set('Cache', new Cache());
    $app->get('Cache')->setDir(APP_CACHE);
    $app->get('Cache')->setTime($app->get('config.cache.time'));
    $app->get('Cache')->setExt($app->get('config.cache.ext'));
    $app->get('Cache')->setIgnore($app->get('config.cache.ignore'));
}
/*
 * Set database
コード例 #3
0
<?php

/**
 * Bootstrap template
 */
use WebSupportDK\PHPMvcFramework\View;
define('CONTROLLERPATH', ABSPATH . 'app/Controllers' . DIRECTORY_SEPARATOR);
if (!defined('APP_DEFAULT_THEME')) {
    define('APP_DEFAULT_THEME', $app->get('config')->site->{'default theme'});
}
define('TEMPLATEPATH', APPTHEME . APP_DEFAULT_THEME . DIRECTORY_SEPARATOR);
$view = View::load();
$view->setTemplatePath(TEMPLATEPATH);
$view->setFeedbackFile(APPTEMPLATE . 'feedback');
$app->set('theme', json_decode(file_get_contents(TEMPLATEPATH . 'theme.json')));