Exemple #1
0
 /**
  * {@inheritdoc}
  *
  * @param \Phalcon\Mvc\ViewInterface $view
  * @param \Phalcon\DiInterface       $di
  * @param array                      $options
  */
 public function __construct($view, $di = null, $options = array(), $arrFolder = array())
 {
     $arrFolder[] = $view->getViewsDir();
     $loader = new \Twig_Loader_Filesystem($arrFolder);
     if (!is_array($options)) {
         $options = array();
     }
     $this->twig = new Twig\Environment($di, $loader, $options);
     $this->twig->addExtension(new Twig\CoreExtension());
     $this->registryFunctions($view, $di);
     // $function = new Twig_SimpleFunction('inc', function(Twig_Environment $env, $context, $template, $variables = array(), $withContext = true, $ignoreMissing = false, $sandboxed = false) {
     //     //  GET json filename
     //     $jsonFilename           = str_replace('.twig', '.json', $template);
     //     //  IF json default data exists
     //     if(file_exists(ABS_ROOT.'views/'.$jsonFilename))
     //     {
     //         //  GET data
     //         $arrData            = json_decode(file_get_contents(ABS_ROOT.'views/'.$jsonFilename), true);
     //         //  MERGE data into context
     //         foreach($arrData AS $key => $data)
     //         {
     //             if(!array_key_exists($key, $context))
     //             {
     //                 $context[$key]  = $data;
     //             }
     //         }
     //     }
     //     //  INCLUDE and display template
     //     echo twig_include($env, $context, $template, $variables, $withContext, $ignoreMissing, $sandboxed);
     // }, array('needs_environment' => true, 'needs_context' => true));
     // $this->twig->addFunction($function);
     parent::__construct($view, $di);
 }
Exemple #2
0
 /**
  * Phalcon\Mvc\View\Engine\Twig constructor
  *
  * @param \Phalcon\Mvc\ViewInterface $view
  * @param \Phalcon\DiInterface $di
  * @param array $options TwigEnvironmentOptions
  */
 public function __construct($view, $di = null, $options = [])
 {
     $loader = new \Twig_Loader_Filesystem($view->getViewsDir());
     $this->_twig = new Twig\Environment($di, $loader, $options);
     $this->_twig->addExtension(new Twig\CoreExtension());
     $this->registryFunctions($view);
     parent::__construct($view, $di);
 }
Exemple #3
0
 /**
  * {@inheritdoc}
  *
  * @param ViewBaseInterface $view
  * @param DiInterface       $di
  * @param array             $options
  * @param array             $userFunctions
  */
 public function __construct(ViewBaseInterface $view, DiInterface $di = null, $options = array(), $userFunctions = array())
 {
     $loader = new \Twig_Loader_Filesystem($view->getViewsDir());
     $this->twig = new Twig\Environment($di, $loader, $options);
     $this->twig->addExtension(new Twig\CoreExtension());
     $this->registryFunctions($view, $di, $userFunctions);
     parent::__construct($view, $di);
 }
Exemple #4
0
 /**
  * {@inheritdoc}
  *
  * @param \Phalcon\Mvc\ViewInterface $view
  * @param \Phalcon\DiInterface $di
  * @param array $options
  * @param array $userFunctions
  */
 public function __construct($view, \Phalcon\DiInterface $di = null, $options = [], $userFunctions = [])
 {
     $loader = new \Twig_Loader_Filesystem($view->getViewsDir());
     $this->twig = new Environment($di, $loader, $options);
     $this->twig->addExtension(new CoreExtension());
     $this->twig->addExtension(new \Twig_Extension_Debug());
     $this->registryFunctions($view, $di, $userFunctions);
     parent::__construct($view, $di);
 }
Exemple #5
0
 public function __construct($view, $dependencyInjector = NULL)
 {
     $this->_smarty = static::getSmarty();
     //$this->_smarty->config_dir = SMARTY_DIR . 'configs';
     //$this->_smarty->cache_dir = SMARTY_DIR . 'cache';
     //$this->_smarty->caching = false;
     //$this->_smarty->debugging = true;
     parent::__construct($view, $dependencyInjector);
 }
Exemple #6
0
 /**
  * {@inheritdoc}
  *
  * @param ViewBaseInterface $view
  * @param DiInterface       $di
  */
 public function __construct(ViewBaseInterface $view, DiInterface $di = null)
 {
     $this->smarty = new \Smarty();
     $this->smarty->template_dir = '.';
     $this->smarty->compile_dir = SMARTY_DIR . 'templates_c';
     $this->smarty->config_dir = SMARTY_DIR . 'configs';
     $this->smarty->cache_dir = SMARTY_DIR . 'cache';
     $this->smarty->caching = false;
     $this->smarty->debugging = true;
     parent::__construct($view, $di);
 }
Exemple #7
0
 /**
  * Class constructor.
  *
  * @param \Phalcon\Mvc\ViewInterface $view
  * @param \Phalcon\DiInterface       $dependencyInjector
  */
 public function __construct($view, $dependencyInjector = null)
 {
     $this->mustache = new \Mustache_Engine();
     $loader = new MustachePartialsLoader($view, $this);
     $this->mustache->setPartialsLoader($loader);
     if ($dependencyInjector !== null) {
         $this->setDi($dependencyInjector);
     }
     $this->mustache->addHelper('uppercase', function ($value) {
         return strtoupper((string) $value);
     });
     parent::__construct($view, $dependencyInjector);
 }
 public function __construct(Phalcon\Mvc\View $view, Phalcon\DI $di)
 {
     $this->_smarty = new Smarty();
     $this->_smarty->template_dir = '.';
     $this->_smarty->compile_dir = PUBLIC_PATH . '/__runtime/script';
     // $this->_smarty->config_dir = SMARTY_DIR . 'configs';
     $this->_smarty->cache_dir = PUBLIC_PATH . '/__runtime/cache';
     $this->_smarty->caching = false;
     $this->_smarty->debugging = true;
     $this->_smarty->left_delimiter = '<{';
     $this->_smarty->right_delimiter = '}>';
     $this->_smarty->cache_lifetime = 100;
     parent::__construct($view, $di);
 }
Exemple #9
0
 public function __construct($view, $di = null)
 {
     $loader = new Twig_Loader_Filesystem($view->getViewsDir());
     $this->_twig = new Twig_Environment($loader);
     parent::__construct($view, $di);
 }
Exemple #10
0
 /**
  * Engine constructor
  *
  * @param \Phalcon\Mvc\ViewInterface $view
  * @param \Phalcon\DiInterface       $dependencyInjector
  */
 public function __construct($view, $dependencyInjector = null)
 {
     $parser = new \Baseapp\Library\Parsedown\ParsedownExtra();
     $this->markdown = $parser;
     parent::__construct($view, $dependencyInjector);
 }
Exemple #11
0
 /**
  * Engine constructor
  *
  * @param \Phalcon\Mvc\ViewInterface $view
  * @param \Phalcon\DiInterface       $dependencyInjector
  */
 public function __construct(\Phalcon\Mvc\ViewBaseInterface $view, \Phalcon\DiInterface $dependencyInjector = null)
 {
     $parser = new \Baseapp\Library\Parsedown\ParsedownExtra();
     $this->markdown = $parser;
     parent::__construct($view, $dependencyInjector);
 }
Exemple #12
0
 /**
  * Adapter constructor
  *
  * @param \Phalcon\Mvc\View $view
  * @param \Phalcon\DI $di
  * @param array $options
  */
 public function __construct($view, $di, $options = array())
 {
     //Initialize here the adapter
     parent::__construct($view, $di);
     $this->jade = new \Jade\Jade($options);
 }
Exemple #13
0
 /**
  * Phalcon\Mvc\View\Engine\Mustache constructor
  *
  * @param \Phalcon\Mvc\ViewInterface $view
  * @param \Phalcon\DiInterface $di
  */
 public function __construct($view, $di)
 {
     $this->_mustache = new \Mustache_Engine();
     parent::__construct($view, $di);
 }
Exemple #14
0
 public function __construct($view, $di)
 {
     parent::__construct($view, $di);
     $this->blade_engine = new CompilerEngine(new BladeCompiler(new Filesystem(), config()->path->storage_views));
 }
 /**
  * @param PhView $view
  * @param PhDi $di
  * @param LatteFactory $factory
  */
 function __construct(PhView $view, PhDi $di, LatteFactory $factory)
 {
     parent::__construct($view, $di);
     $this->latte = $factory->create();
 }
Exemple #16
0
 /**
  * Twig constructor.
  *
  * @param ViewBaseInterface $view
  * @param DiInterface|null $dependencyInjector
  */
 public function __construct(ViewBaseInterface $view, DiInterface $dependencyInjector = null)
 {
     $this->twig = new Twig_Environment(new Twig_Loader_Filesystem($view->getViewsDir()));
     parent::__construct($view, $dependencyInjector);
 }
Exemple #17
0
 /**
  * {@inheritdoc}
  *
  * @param ViewBaseInterface $view
  * @param DiInterface       $di
  */
 public function __construct(ViewBaseInterface $view, DiInterface $di = null)
 {
     $this->mustache = new \Mustache_Engine();
     parent::__construct($view, $di);
 }
Exemple #18
0
 public function __construct($view, $di)
 {
     parent::__construct($view, $di);
 }
Exemple #19
0
 /**
  * Class constructor.
  *
  * @param \Phalcon\Mvc\ViewInterface $view
  * @param \Phalcon\DiInterface       $dependencyInjector
  * @param array $options (default: array())
  */
 public function __construct($view, $dependencyInjector = null, array $options = array())
 {
     $this->mustache = new \Mustache_Engine($options);
     parent::__construct($view, $dependencyInjector);
 }
Exemple #20
0
 public function __construct(\Phalcon\Mvc\ViewBaseInterface $view, \Phalcon\DiInterface $di = null)
 {
     $loader = new Twig_Loader_Filesystem($view->getViewsDir());
     $this->_twig = new Twig_Environment($loader);
     parent::__construct($view, $di);
 }
 public function __construct(ViewBaseInterface $view, DiInterface $di = null)
 {
     parent::__construct($view, $di);
     $this->blade = new Blade($this->getView()->getViewsDir(), storage_path('views') . '/');
 }
Exemple #22
0
 /**
  * Adapter constructor
  *
  * @param \Phalcon\Mvc\View $view
  * @param \Phalcon\DI       $di
  */
 public function __construct($view, $di)
 {
     //Initiliaze here the adapter
     parent::__construct($view, $di);
 }
Exemple #23
0
 /**
  * Phalcon\Mvc\View\Engine\Mustache constructor
  *
  * @param \Phalcon\Mvc\ViewInterface $view
  * @param \Phalcon\DiInterface $di
  */
 public function __construct($view, $dependencyInjector = null)
 {
     $this->_mustache = new \Mustache_Engine();
     parent::__construct($view, $dependencyInjector);
 }
Exemple #24
0
 /**
  * Mustache constructor.
  *
  * @param ViewBaseInterface $view
  * @param DiInterface|null $dependencyInjector
  */
 public function __construct(ViewBaseInterface $view, DiInterface $dependencyInjector = null)
 {
     $this->mustache = new Mustache_Engine();
     parent::__construct($view, $dependencyInjector);
 }