Advertisement
Guest User

services.php

a guest
Nov 25th, 2014
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1. <?php
  2.  
  3.     use Phalcon\Mvc\Url as UrlResolver;
  4.     use Phalcon\Db\Adapter\Pdo\Mysql as DbAdapter;
  5.     use Phalcon\Mvc\Model\Metadata\Memory as MetaDataAdapter;
  6.     use Phalcon\Session\Adapter\Files as SessionAdapter;
  7.  
  8.     $di = new Phalcon\DI\FactoryDefault;
  9.    
  10.     $di->set('config', $config);
  11.    
  12.     $di->set('view', function () use ($config) {
  13.  
  14.         $view = new Phalcon\Mvc\View;
  15.  
  16.         $view->setViewsDir($config->application->viewsDir);
  17.  
  18.         $view->registerEngines(array(
  19.                 '.volt' => function ($view, $di) use ($config) {
  20.  
  21.                     $volt = new Phalcon\Mvc\View\Engine\Volt($view, $di);
  22.  
  23.                     $volt->setOptions(array(
  24.                         'compiledPath' => $config->application->cacheDir,
  25.                         'compiledSeparator' => '_'
  26.                     ));
  27.  
  28.                     return $volt;
  29.                 },
  30.                 '.phtml' => 'Phalcon\Mvc\View\Engine\Php'
  31.             ));
  32.  
  33.             return $view;
  34.     }, true);
  35.    
  36.     $di->set('router', function () {
  37.         return require __DIR__ . '/routes.php';
  38.     });
  39. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement