Ejemplo n.º 1
0
 /**
  * Init a parser
  */
 public function init()
 {
     parent::init();
     $this->options['cache'] = Yii::getAlias($this->cachePath);
     $haml = new MtHaml\Environment('twig', $this->options, $this->getFilters());
     $fs = new \Twig_Loader_Filesystem([dirname(Yii::$app->getView()->getViewFile()), Yii::$app->getViewPath()]);
     $loader = new MtHaml\Support\Twig\Loader($haml, $fs);
     $this->parser = new \Twig_Environment($loader, ['cache' => Yii::getAlias($this->cachePath)]);
     $this->parser->addExtension(new MtHaml\Support\Twig\Extension($haml));
     if (!empty($this->extensions)) {
         foreach ($this->extensions as $name) {
             $this->parser->addExtension($this->getExtension($name));
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Init a haml parser instance
  */
 public function init()
 {
     parent::init();
     $haml = new MtHaml\Environment('php', $this->options, $this->getFilters());
     $this->parser = new \mervick\mthaml\override\Executor($haml, ['cache' => Yii::getAlias($this->cachePath), 'debug' => $this->debug]);
 }