Пример #1
0
 public function __construct()
 {
     $this->parser = new Parser();
     Macros\CoreMacros::install($this->parser);
     $this->parser->addMacro('cache', new Macros\CacheMacro($this->parser));
     Macros\UIMacros::install($this->parser);
     Macros\FormMacros::install($this->parser);
 }
Пример #2
0
 public function __construct()
 {
     $this->parser = new Parser();
     $this->compiler = new Compiler();
     $this->compiler->defaultContentType = Compiler::CONTENT_XHTML;
     CoreMacros::install($this->compiler);
     $this->compiler->addMacro('cache', new GlobalCacheMacro($this->compiler));
     FormMacros::install($this->compiler);
 }
Пример #3
0
 /**
  * Prepares Latte macros
  *
  * @param  Nette\Latte\Compiler
  * @return void
  */
 protected function lattePrepareMacros(Nette\Latte\Compiler $compiler, Nette\Templating\Template $template)
 {
     Nette\Latte\Macros\CoreMacros::install($compiler);
     $compiler->addMacro('cache', new Nette\Latte\Macros\CacheMacro($compiler));
     // Must be after CoreMacros (overrides {_'xxx'})
     vBuilder\Latte\Macros\TranslationMacros::install($compiler);
     // Must be before UIMacros
     vBuilder\Latte\Macros\SystemMacros::install($compiler);
     vBuilder\Latte\Macros\UIMacros::install($compiler);
     Nette\Latte\Macros\FormMacros::install($compiler);
     vBuilder\Latte\Macros\RegionMacros::install($compiler);
 }
Пример #4
0
 /**
  * Prepares Latte macros
  *
  * @param  Nette\Latte\Compiler
  * @return void
  */
 protected function lattePrepareMacros(Nette\Latte\Compiler $compiler, Nette\Templating\Template $template)
 {
     Nette\Latte\Macros\CoreMacros::install($compiler);
     $compiler->addMacro('cache', new Nette\Latte\Macros\CacheMacro($compiler));
     // Must be after CoreMacros (overrides {_'xxx'})
     vBuilder\Latte\Macros\TranslationMacros::install($compiler);
     // Must be before UIMacros
     vBuilder\Latte\Macros\SystemMacros::install($compiler);
     // Auto-extend for templates
     $autoExtend = NULL;
     if ($template instanceof Nette\Templating\FileTemplate && $template->getFile() != "" && $template->getFile() != $this->getDefaultTemplateFile() && file_exists($this->getDefaultTemplateFile())) {
         // If the basename is same but the dir differs
         if (preg_match('#^(.*?)([^/]+)$#', $template->getFile(), $mCurrent) && preg_match('#^(.*?)([^/]+)$#', $this->getDefaultTemplateFile(), $mDefault)) {
             if ($mCurrent[2] == $mDefault[2]) {
                 $autoExtend = $this->getDefaultTemplateFile();
             }
         }
     }
     if ($autoExtend) {
         vBuilder\Latte\Macros\UIMacros::installWithAutoExtend($compiler, $autoExtend);
     } else {
         vBuilder\Latte\Macros\UIMacros::install($compiler);
     }
     Nette\Latte\Macros\FormMacros::install($compiler);
     vBuilder\Latte\Macros\RegionMacros::install($compiler);
 }