Example #1
0
<?php

/**
 * TinyMe Application
 */
require __DIR__ . "/../bootstrap/init.php";
Flight::before('start', ['TinyMe', 'bootstrap']);
Flight::start();
Example #2
0
<?php

/**
 * Demo Application
 */
require __DIR__ . "/bootstrap/init.php";
Flight::before("start", array("Controller", "init"));
Flight::start();
Example #3
0
 * Initiate Twig, and register to Flight
 */
$twigLoader = new Twig_Loader_Filesystem('../templates');
$twigConfig = array('cache' => Flight::get('config')->get('cache.enabled') ? Flight::get('config')->get('cache.path') . 'twig/' : false, 'debug' => Flight::get('config')->get('debug'));
Flight::register('view', 'Twig_Environment', array($twigLoader, $twigConfig), function ($twig) {
    $twig->addExtension(new Twig_Extension_Debug());
    // Add the debug extension
    $currentUrl = sprintf("%s://%s%s", isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', $_SERVER['SERVER_NAME'], $_SERVER['REQUEST_URI']);
    $twig->addGlobal('CurrentUrl', $currentUrl);
});
/**
 * Add navigation hook on start, get all links and store them in config -> 'app.navigation'
 */
Flight::before('start', function (&$params, &$output) {
    if (Flight::has('navigation.loader')) {
        return;
    }
    Flight::get('config')->initNavigation(Flight::request()->url);
});
// ! --- ROUTE: Index ---------------------------
Flight::route('/', function () {
    return Flight::view()->display('index.php', Flight::get('config')->getTemplateData());
});
// ! --- ROUTE: About ---------------------------
Flight::route('/we', function () {
    return Flight::get('config')->renderPage('about');
});
// ! --- ROUTE: Sitemap -------------------------
/**
 * Publishes all routes in the /sitemap.xml
 */
Flight::route('/sitemap.xml', function () {