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


PHP Engine::setFileExtension方法代码示例

本文整理汇总了PHP中League\Plates\Engine::setFileExtension方法的典型用法代码示例。如果您正苦于以下问题:PHP Engine::setFileExtension方法的具体用法?PHP Engine::setFileExtension怎么用?PHP Engine::setFileExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在League\Plates\Engine的用法示例。


在下文中一共展示了Engine::setFileExtension方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getInstance

 public function getInstance()
 {
     if (!$this->_engineInstance) {
         // Create new Plates engine
         $this->_engineInstance = new PlatesEngine($this->getTemplatesDirectory());
         if ($this->fileExtension) {
             $this->_engineInstance->setFileExtension($this->fileExtension);
         }
     }
     return $this->_engineInstance;
 }
开发者ID:jmrunkle,项目名称:ifitfitsifitbits,代码行数:11,代码来源:PlatesView.php

示例2: __construct

 /**
  * The transformer constructor.
  *
  * Options are:
  *   - "plates" a \League\Plates\Engine instance
  *   - "directory" the directory where Plates will search templates
  *   - "extension" the extension of template files
  * if the option "plates" is provided, options "default" and "extension" are ignored.
  *
  * @param array $options The PlatesTransformer options
  */
 public function __construct(array $options = array())
 {
     if (array_key_exists('plates', $options)) {
         $this->plates = $options['plates'];
         return;
     }
     $this->plates = new Engine(getcwd(), null);
     if (array_key_exists('directory', $options)) {
         $this->plates->setDirectory($options['directory']);
     }
     if (array_key_exists('extension', $options)) {
         $this->plates->setFileExtension($options['extension']);
     }
 }
开发者ID:phptransformers,项目名称:plates,代码行数:25,代码来源:PlatesTransformer.php

示例3: setUp

 protected function setUp()
 {
     $plates = new Engine(__DIR__ . '/Resources/views');
     $plates->setFileExtension(null);
     $plates->addData(['foo' => 'bar']);
     $this->engine = new PlatesEngineAdapter($plates);
 }
开发者ID:Symfomany,项目名称:laravelcinema,代码行数:7,代码来源:PlatesEngineAdapterTest.php

示例4: getInstance

 /**
  * Get a Plates engine
  *
  * @return \League\Plates\Engine
  */
 public function getInstance()
 {
     if (!$this->engineInstance) {
         // Create new Plates engine
         $this->engineInstance = new \League\Plates\Engine($this->templatesPath ?: $this->getTemplatesDirectory());
         if ($this->fileExtension) {
             $this->engineInstance->setFileExtension($this->fileExtension);
         }
         if (count($this->templatesFolders)) {
             foreach ($this->templatesFolders as $name => $path) {
                 $this->engineInstance->addFolder($name, $path);
             }
         }
     }
     return $this->engineInstance;
 }
开发者ID:philipsharp,项目名称:slim-view-plates,代码行数:21,代码来源:Plates.php

示例5: plates

 private function plates()
 {
     $league = new Plates\Engine(APP . 'views');
     $league->setFileExtension('tpl');
     $league->loadExtension(new Plates\Extension\URI(trim(strtok(str_replace($_SERVER['SCRIPT_NAME'], '', $_SERVER['REQUEST_URI']), '?'), '/')));
     $league->loadExtension(new MY\Plates\Extension());
     return $league;
 }
开发者ID:jezqhiel,项目名称:cms-packages,代码行数:8,代码来源:Controller.php

示例6: __invoke

 public function __invoke(array $config)
 {
     $theme = $config['theme'];
     $templateEngine = new Engine();
     $templateEngine->addFolder('app', 'templates');
     $templateEngine->addFolder('theme', 'public/themes/' . $theme . '/templates');
     $templateEngine->setFileExtension('phtml');
     $templateEngine->loadExtensions([new AssetExt('public', true), new ThemeAssetExt('themes/' . $theme . '/assets')]);
     return new Application($config, new PlatesTemplateRenderer($templateEngine));
 }
开发者ID:nikolaposa,项目名称:devpage,代码行数:10,代码来源:ApplicationFactory.php

示例7: getInstance

 /**
  * Get an instance of the Plates Engine
  *
  * @return \League\Plates\Engine
  */
 public function getInstance()
 {
     if (!$this->engineInstance) {
         $this->engineInstance = new Engine($this->templatesPath ?: $this->getTemplatesDirectory());
         if ($this->fileExtension) {
             $this->engineInstance->setFileExtension($this->fileExtension);
         }
         if (count($this->templatesFolders) > 0) {
             foreach ($this->templatesFolders as $name => $path) {
                 $this->engineInstance->addFolder($name, $path);
             }
         }
         if (count($this->parserExtensions) > 0) {
             foreach ($this->parserExtensions as $extension) {
                 $this->engineInstance->loadExtension($extension);
             }
         }
     }
     return $this->engineInstance;
 }
开发者ID:media32,项目名称:slim-view-plates,代码行数:25,代码来源:Plates.php

示例8: __invoke

 /**
  * @param ContainerInterface $container
  * @return PlatesRenderer
  */
 public function __invoke(ContainerInterface $container)
 {
     $config = $container->has('config') ? $container->get('config') : [];
     $config = isset($config['templates']) ? $config['templates'] : [];
     // Create the engine instance:
     $engine = new PlatesEngine();
     // Set file extension
     if (isset($config['extension'])) {
         $engine->setFileExtension($config['extension']);
     }
     // Inject engine
     $plates = new PlatesRenderer($engine);
     // Add template paths
     $allPaths = isset($config['paths']) && is_array($config['paths']) ? $config['paths'] : [];
     foreach ($allPaths as $namespace => $paths) {
         $namespace = is_numeric($namespace) ? null : $namespace;
         foreach ((array) $paths as $path) {
             $plates->addPath($path, $namespace);
         }
     }
     return $plates;
 }
开发者ID:weierophinney,项目名称:zend-expressive-platesrenderer,代码行数:26,代码来源:PlatesRendererFactory.php

示例9: prepareTemplates

 public function prepareTemplates(Engine $template, Injector $injector)
 {
     $template->addData(['pages' => $this->getPages()]);
     $template->setFileExtension('phtml');
     $template->loadExtension(new DirectoryExtension());
 }
开发者ID:graphis,项目名称:cookcountycommunityfund,代码行数:6,代码来源:PlatesConfiguration.php

示例10: registerTemplateEngine

 protected function registerTemplateEngine()
 {
     $this->slim->container->singleton('plates.engine', function () {
         $engine = new Engine();
         $engine->setFileExtension($this->slim->config('controller.template_suffix'))->loadExtension(new Asset(self::getWebDir()))->setDirectory($this->getAppDir() . '/Resources/views');
         return $engine;
     });
     $this->slim->container->singleton('plates.template', function () {
         $template = new Template($this->slim->container->get('plates.engine'));
         return $template;
     });
     $this->slim->config('view', new PlatesView($this->slim));
     return $this;
 }
开发者ID:chellem,项目名称:symslim,代码行数:14,代码来源:Kernel.php

示例11: setTemplateEngine

 /**
  * @param Engine $templateEngine
  * @Required
  */
 public function setTemplateEngine(Engine $templateEngine)
 {
     $this->templateEngine = $templateEngine;
     $this->templateEngine->setFileExtension(null);
 }
开发者ID:cloudfoundry-community,项目名称:php-cf-service-broker,代码行数:9,代码来源:MicroWebFramework.php

示例12: setUp

 protected function setUp()
 {
     $engine = new Engine(dirname(__DIR__) . '/Fixtures');
     $this->plates = new Template($engine->setFileExtension(null));
     $this->engine = new PlatesEngine($this->plates);
     $this->template = 'foobar.plates.php';
 }
开发者ID:gigablah,项目名称:silex-view,代码行数:7,代码来源:PlatesEngineTest.php


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