当前位置: 首页>>代码示例>>PHP>>正文


PHP View::__construct方法代码示例

本文整理汇总了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'));
 }
开发者ID:arius86,项目名称:core,代码行数:34,代码来源:View.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);
 }
开发者ID:abc2001x,项目名称:phalcon_mode,代码行数:7,代码来源:BaseView.php

示例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);
 }
开发者ID:tmquang6805,项目名称:phalex,代码行数:38,代码来源:View.php

示例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);
 }
开发者ID:phwoolcon,项目名称:phwoolcon,代码行数:15,代码来源:View.php

示例5: __construct

 public function __construct()
 {
     parent::__construct();
 }
开发者ID:lisong,项目名称:incubator,代码行数:4,代码来源:SmartyView.php

示例6: __construct

 /**
  * Constructor
  *
  * @param \Phalcon\DI   $di
  */
 public function __construct($options = null)
 {
     parent::__construct($options);
 }
开发者ID:JanOschii,项目名称:webird,代码行数:9,代码来源:View.php


注:本文中的Phalcon\Mvc\View::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。