Ejemplo n.º 1
0
 /**
  * Returns the Volt's compiler
  *
  * @return \Phalcon\Mvc\View\Engine\Volt\Compiler
  */
 public function getCompiler()
 {
     if (is_object($this->_compiler) === false) {
         $compiler = new Compiler();
         //Pass the IoC to the compiler only if it's an object
         if (is_object($this->_dependencyInjector) === true) {
             $compiler->setDi($this->_dependencyInjector);
         }
         //Pass the options to the compiler only if they're an array
         if (is_array($this->_options) === true) {
             $compiler->setOptions($this->_options);
         }
         $this->_compiler = $compiler;
     }
     return $this->_compiler;
 }
Ejemplo n.º 2
0
 public function getVoltCompiler()
 {
     $volt = new VoltCompiler();
     $volt->setOptions(array('stat' => true, 'compileAlways' => true));
     require CORE_PATH . 'config/volt.functions.php';
     foreach ($voltFunctions as $macro => $function) {
         $volt->addFunction($macro, $function);
     }
     return $volt;
 }