示例#1
0
<?php

use Nette\Diagnostics\Debugger;
require LIBS_DIR . '/nette/Nette/loader.php';
Debugger::enable();
if (!file_exists(TEMP_DIR)) {
    throw new Exception(sprintf('Temp dir "%s" does not exist', TEMP_DIR));
}
$configurator = new Nette\Configurator();
$configurator->loadConfig(__DIR__ . '/config.neon');
// Configure application
$application = $configurator->container->application;
$application->errorPresenter = 'Error';
//$application->catchExceptions = TRUE;
// Setup application router
$router = $application->getRouter();
$router[] = new Nette\Application\Routers\SimpleRouter(array('presenter' => 'Homepage', 'action' => 'default', 'id' => NULL));
// Run the application!
$application->run();
示例#2
0
文件: bootstrap.php 项目: bazo/Tatami
use Nette\Diagnostics\Debugger, Nette\Application\Routers\SimpleRouter, Nette\Application\Routers\Route, Tatami\Events\Event;
// Load Nette Framework
$params['libsDir'] = __DIR__ . '/../libs';
require $params['libsDir'] . '/Nette/loader.php';
$params['logDir'] = __DIR__ . '/../log';
Debugger::$logDirectory = $params['logDir'];
Debugger::$strictMode = TRUE;
//Debugger::$productionMode = false;
Debugger::enable('188.167.64.246');
$params['assetsDir'] = __DIR__ . '/assets';
$configurator = new Nette\Configurator();
$configurator->container->params += $params;
$configurator->container->params['tempDir'] = __DIR__ . '/../temp';
//check if generated config exists
try {
    $configurator->loadConfig($params['appDir'] . '/config/config.neon');
} catch (\Nette\FileNotFoundException $e) {
    //if not, read the default config and install application
    $configurator->loadConfig($params['appDir'] . '/config/config-default.neon');
}
$router = new \Tatami\Routing\TatamiRouter();
$configurator->getContainer()->addService('router', $router);
$application = $configurator->container->application;
$application->errorPresenter = 'Error';
//$application->catchExceptions = TRUE;
$application->onStartup[] = function (Nette\Application\Application $application) use($configurator) {
    $router = $application->getRouter();
    $router instanceof \Tatami\Routing\Router;
    $eventManager = $configurator->getContainer()->getService('eventManager');
    $params = $configurator->getContainer()->params;
    if (isset($params['installed']) and $params['installed'] == true) {