When in a view, the local scope is that of an instance of Renderer - meaning that $this in views is an instance of the current renderer adapter. For more information about implementing your own template loaders or renderers, see the lithium\template\View class.
See also: lithium\template\View
See also: lithium\template\adapter\File
See also: lithium\template\adapter\Simple
Inheritance: extends lithium\core\Object
Exemple #1
0
 public function __construct($config = array())
 {
     $this->_smarty = new \Smarty();
     $this->_smarty->compile_dir = $config['compile_dir'];
     $this->_smarty->cache_dir = $config['cache_dir'];
     $this->_smarty->setTemplateDir($config['template_dir']);
     $this->_smarty->addPluginsDir($config['plugin_dir']);
     $defaults = array('classes' => array());
     parent::__construct($config + $defaults);
 }
Exemple #2
0
 /**
  * Initialize the necessary Twig objects & attach them to the current object instance.
  * Attach any configured filters in the lithium app bootstrap to the Twig object.
  *
  * @return void
  */
 protected function _init()
 {
     parent::_init();
     $loader = new Twig_Loader_Filesystem(array());
     $this->environment = new Twig_Environment($loader, $this->_config);
     Twig::$_lithiumContext = $this;
     $library = Libraries::get('li3_twig');
     $defaults = array('register' => array('magicHelperMethod' => false, 'globals' => false), 'extensions' => array());
     $options = empty($library['config']) || !is_array($library['config']) ? $defaults : $library['config'] + $defaults;
     if ($options['register']['magicHelperMethod']) {
         $this->environment->addFunction('*_*', new Twig_Function_Function('li3_twig\\template\\view\\adapter\\Twig::callLithiumHelper'));
     }
     if ($options['register']['globals']) {
         $this->environment->addGlobal('view', $this);
         $this->environment->addGlobal('this', $this);
     }
     if (!empty($options['extensions'])) {
         foreach ($options['extensions'] as $extension) {
             $extensions = $this->helper($extension);
             $this->environment->addExtension($extensions);
         }
     }
 }
Exemple #3
0
 public function __construct(array $config = array())
 {
     $defaults = array('classes' => array(), 'compile' => true, 'compiler' => array(), 'extract' => true, 'paths' => array());
     parent::__construct($config + $defaults);
 }
 public function __construct($config = array())
 {
     $defaults = array('classes' => array(), 'compile' => true);
     parent::__construct((array) $config + $defaults);
 }
 public function __construct($config = array())
 {
     $defaults = array('classes' => array());
     parent::__construct($config + $defaults);
 }
Exemple #6
0
 /**
  * Initialize the necessary Twig objects & attach them to the current object instance.
  *
  * @return void
  */
 public function _init()
 {
     parent::_init();
     $Loader = new Twig_Loader_Filesystem(array());
     $this->environment = new Twig_Environment($Loader, $this->_config);
 }