Example #1
0
 public function __construct()
 {
     global $app;
     $this->app = $app;
     $this->db = \Prolio\Model\Spdo::get();
     $this->table = $this->db->getPrefix() . $this->table;
 }
Example #2
0
$app->view->parserOptions = array('debug' => true, 'cache' => APP_DIR . '/cache');
$app->view->parserExtensions = array(new \Slim\Views\TwigExtension());
// Need install?
if (!file_exists(APP_DIR . '/config/config.php')) {
    $app->get('/', '\\Prolio\\Controller\\Install:index')->via('GET', 'POST')->name('install');
    $app->run();
    exit;
}
// Configuration
require APP_DIR . '/config/config.php';
$app->config($config);
$app->view->setTemplatesDirectory(APP_DIR . '/themes/' . $config['site']['theme']);
// Session
session_cache_limiter(false);
session_start();
// Debug
if ($environment == 'dev') {
    $debugbar = new \Slim\Middleware\DebugBar();
    $app->add($debugbar);
}
// Database
$dbConfig = $app->config('database');
\Prolio\Model\Spdo::setMysqlParams($dbConfig['host'], $dbConfig['name'], $dbConfig['user'], $dbConfig['pass'], $dbConfig['prefix']);
// Site Title
$pageModel = new \Prolio\Model\Page();
$home = $pageModel->getBySlug('home');
$app->view->getInstance()->addGlobal('siteTitle', $home->name);
// Routes
require APP_DIR . '/config/routes.php';
// Go
$app->run();