/** * Constructor * Prepares view settings and engine * * @override * @param null $options * @param null $viewDir */ public function __construct($options = null, $viewDir = null) { parent::__construct($options); if (isset($options['layoutsDir'])) { $this->setLayoutsDir($options['layoutsDir']); } if (isset($options['partialsDir']) && $options['partialsDir']) { $this->setPartialsDir($options['partialsDir']); } if (!$this->getPartialsDir() && $viewDir) { $this->setPartialsDir($viewDir); } if (isset($options['layout']) && !empty($options['layout'])) { $this->setLayout($options['layout']); } $this->registerEngines(array('.volt' => function ($this, $di) use($options) { $volt = new Volt($this, $di); if (isset($options['cacheDir'])) { $volt->setOptions(array('compiledPath' => $options['cacheDir'], 'compiledSeparator' => '_', 'compileAlways' => isset($options['compileAlways']) ? $options['compileAlways'] : false)); } $volt->registerFilters(); $volt->registerHelpers(); $volt->setExtension('.volt'); return $volt; }, '.phtml' => 'Phalcon\\Mvc\\View\\Engine\\Php')); }
public function __construct($opt = null) { $this->renderCounter = 0; //大于零则表示为非action模板定位 // $this->log = new \Phalcon\Logger\Adapter\File(getcwd().'/view.log'); parent::__construct($opt); }
/** * Constructor for phalex view * * <ul> * <li>array['di'] <i>\Phalex\Di\Di</i> REQUIRED</li> * <li>array['views_dir'] <i>string</i> Sets views directory. Depending of your platform, * always add a trailing slash or backslash. REQUIRED</li> * <li>array['volt'] <i>array</i> Options when using volt template. OPTIONAL</li> * <ul> * <li>['path'] <i>string</i> A writable path where the compiled PHP templates * will be placed.</li> * <li>['extension'] <i>string</i> An extension appended to the compiled PHP file</li> * <li>['hierarchical'] <i>bool</i> Set compiled hierarchical. Default is FALSE</li> * <li>['separator'] <i>string</i> Volt replaces the directory separators / and \ by * this separator in order to create a single file * in the compiled directory. Effect when hierarchical * is FALSE</li> * <li>['always'] <i>bool</i> Tell Volt if the templates must be compiled in each * request or only when they change. Default is FALSE</li> * </ul> * </ul> * @param array $options (See above) * @throws Exception\InvalidArgumentException */ public function __construct(array $options) { if (!isset($options['di']) || !$options['di'] instanceof Di || !isset($options['views_dir'])) { throw new Exception\InvalidArgumentException(sprintf('Invalid options for %s', __CLASS__)); } parent::__construct(); $this->setDI($options['di']); $this->setViewsDir($options['views_dir']); $engines = ['.phtml' => Engine\Php::class, '.volt' => $this->setVoltEngine(isset($options['volt']) ? $options['volt'] : [])]; if (isset($options['engines'])) { $engines = $options['engines']; } $this->registerEngines($engines); }
public function __construct($config = null) { parent::__construct($config['options']); $this->response = static::$di->getShared('response'); $this->setViewsDir($this->_viewsDir = $config['path']); $this->_mainView = $config['top_level']; $this->_theme = $config['theme']; $this->_defaultTheme = 'default'; $this->_layout = $config['default_layout']; $this->config = $config; $this->registerEngines($config['engines']); $basePath = $this->config['options']['assets_options']['base_path']; ResourceTrait::setBasePath($basePath); ResourceTrait::setRunningUnitTests(static::$runningUnitTest); }
public function __construct() { parent::__construct(); }
/** * Constructor * * @param \Phalcon\DI $di */ public function __construct($options = null) { parent::__construct($options); }