本文整理汇总了PHP中Phalcon\Mvc\View::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP View::__construct方法的具体用法?PHP View::__construct怎么用?PHP View::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phalcon\Mvc\View
的用法示例。
在下文中一共展示了View::__construct方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* 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'));
}
示例2: __construct
public function __construct($opt = null)
{
$this->renderCounter = 0;
//大于零则表示为非action模板定位
// $this->log = new \Phalcon\Logger\Adapter\File(getcwd().'/view.log');
parent::__construct($opt);
}
示例3: __construct
/**
* 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);
}
示例4: __construct
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);
}
示例5: __construct
public function __construct()
{
parent::__construct();
}
示例6: __construct
/**
* Constructor
*
* @param \Phalcon\DI $di
*/
public function __construct($options = null)
{
parent::__construct($options);
}