Пример #1
0
    return $config;
});
/**
 * Setting up the view component
 */
$di->set('view', function () use($config) {
    $view = new igoView();
    $view->config = $config;
    //$view->host=$config->igo->host;
    if (isset($config->application->pilotage)) {
        //vraiment utile?
        $view->metadonneesViewsDir = $config->application->pilotage->viewsDir;
    }
    $view->viewsDir = $config->application->navigateur->viewsDir;
    // $view->mapserver_path=$config->mapserver->url;
    $view->setViewsDir($config->application->navigateur->viewsDir);
    $view->registerEngines(array('.volt' => function ($view, $di) use($config) {
        $volt = new VoltEngine($view, $di);
        $volt->setOptions(array('compiledPath' => $config->application->navigateur->cacheDir, 'compiledSeparator' => '_', 'compileAlways' => isset($config->application->debug) && $config->application->debug ? true : false));
        return $volt;
    }, '.phtml' => 'Phalcon\\Mvc\\View\\Engine\\Php'));
    return $view;
}, true);
$di->set('dispatcher', function () use($di) {
    //Create/Get an EventManager
    $eventsManager = new Phalcon\Events\Manager();
    //Attach a listener
    $eventsManager->attach("dispatch", function ($event, $dispatcher, $exception) {
        //The controller exists but the action not
        if ($event->getType() == 'beforeNotFoundAction') {
            $dispatcher->forward(array('controller' => 'error', 'action' => 'error404'));
Пример #2
0
    return $url;
}, true);
$di->set('config', function () use($config) {
    return $config;
});
/**
 * Setting up the view component
 */
$di->set('view', function () use($config) {
    $view = new igoView();
    $view->config = $config;
    $view->host = $config->mapserver->host;
    $view->baseUri = $config->uri->pilotage;
    $view->host_alias = $config->mapserver->host;
    $view->mapserver_path = $config->mapserver->mapserver_path;
    $view->setViewsDir($config->application->pilotage->viewsDir);
    $view->registerEngines(array('.volt' => function ($view, $di) use($config) {
        $volt = new VoltEngine($view, $di);
        $volt->setOptions(array('compiledPath' => $config->application->pilotage->cacheDir, 'compiledSeparator' => '_', 'compileAlways' => isset($config->application->debug) && $config->application->debug ? true : false));
        return $volt;
    }, '.phtml' => 'Phalcon\\Mvc\\View\\Engine\\Php'));
    return $view;
}, true);
$di->set('dispatcher', function () use($di) {
    //Create/Get an EventManager
    $eventsManager = new Phalcon\Events\Manager();
    //Attach a listener
    $eventsManager->attach("dispatch", function ($event, $dispatcher, $exception) {
        //The controller exists but the action not
        if ($event->getType() == 'beforeNotFoundAction') {
            $dispatcher->forward(array('controller' => 'error', 'action' => 'error404'));