當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。