예제 #1
0
<?php

ini_set('display_errors', true);
error_reporting(E_ALL);
date_default_timezone_set('UTC');
// Define the site root directory
$site_dir = realpath('../') . '/';
$path_routes = $site_dir . 'routes/';
$path_templates = $site_dir . 'templates/';
$path_layouts = $path_templates . 'layouts/';
include_once '../../../basecoat/basecoat.php';
$bc = new \Basecoat\Basecoat();
//
// Don't use pretty urls/mod_rewrite
$bc->routing->set('use_pretty_urls', false);
$bc->routing->set('route_param', 'page');
/*
// Optionally load database class
// Connection settings for master/slave setup
// Can specify many slaves
$db_settings = array(
    'master' => array(
        'host' => 'masterhost', 'db' => 'test',
        'username' => 'username', 'password' => 'password',
        'label'=>'master'),
    'slave' => array(
        'host' => 'slavehost', 'db' => 'test',
        'username' => 'username', 'password' => 'password',
        'label'=>'slave'),
);
// Load database and specify which setting is the master and which is the slave
예제 #2
0
// Only leave error reporting on in dev
ini_set('display_errors', true);
error_reporting(E_ALL);
// Set timezone
date_default_timezone_set('UTC');
// Configure paths for convenience
define('DIR_LIB', realpath('../lib') . '/');
define('DIR_TPL', realpath('../templates') . '/');
define('DIR_ROUTES', realpath('../routes') . '/');
define('DIR_CONFIG', realpath('../config') . '/');
//
// This should be customized to where the Basecoat framework is located
include_once '../../../basecoat/basecoat.php';
// Create instance of framework
$basecoat = new \Basecoat\Basecoat();
//
// Set path to template files
$basecoat->view->setTemplatesPath(DIR_TPL);
// Set layouts
$basecoat->view->setLayouts(array('basic' => DIR_TPL . 'layouts/basic.php'));
$basecoat->view->setLayout('basic');
// Set routes
$routes = array('/' => array('file' => DIR_ROUTES . 'index.php', 'template' => 'index.tpl.php', 'methods' => array('POST', 'GET')), 'undefined' => array('file' => DIR_ROUTES . '404.php', 'template' => '404.tpl.php', 'cacheable' => array('expires' => '20 minutes')));
// Determine which routes to load
if (in_array($_SERVER['REQUEST_METHOD'], array('GET', 'POST', 'PUT', 'DELETE'))) {
    include_once DIR_CONFIG . 'routes_' . strtolower($_SERVER['REQUEST_METHOD']) . '.php';
}
$basecoat->routing->setRoutes($routes);
$basecoat->routing->addBeforeEach(function () use($basecoat) {
    // Check if method matches