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


PHP Twig_Loader_Filesystem::getSource方法代码示例

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


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

示例1: getSource

 /**
  * {@inheritdoc}
  */
 public function getSource($name)
 {
     $templates = $this->getTemplates($name);
     foreach ($templates as $template) {
         try {
             return $this->loader->getSource($template);
         } catch (\Twig_Error $e) {
         }
     }
     throw new \Twig_Error_Loader(sprintf("Template \"%s\" not found. Tried the following:\n%s", $name, implode("\n", $templates)));
 }
开发者ID:Alltricks,项目名称:multisite-bundle,代码行数:14,代码来源:MultisiteLoader.php

示例2: testFindTemplateWithCache

 public function testFindTemplateWithCache()
 {
     $basePath = dirname(__FILE__) . '/Fixtures';
     $loader = new Twig_Loader_Filesystem(array($basePath . '/normal'));
     $loader->addPath($basePath . '/named', 'named');
     // prime the cache for index.html in the named namespace
     $namedSource = $loader->getSource('@named/index.html');
     $this->assertEquals("named path\n", $namedSource);
     // get index.html from the main namespace
     $this->assertEquals("path\n", $loader->getSource('index.html'));
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:11,代码来源:FilesystemTest.php

示例3: testPaths

 public function testPaths()
 {
     $basePath = dirname(__FILE__) . '/Fixtures';
     $loader = new Twig_Loader_Filesystem(array($basePath . '/normal', $basePath . '/normal_bis'));
     $loader->setPaths(array($basePath . '/named', $basePath . '/named_bis'), 'named');
     $loader->addPath($basePath . '/named_ter', 'named');
     $loader->addPath($basePath . '/normal_ter');
     $loader->prependPath($basePath . '/normal_final');
     $loader->prependPath($basePath . '/named_final', 'named');
     $this->assertEquals(array($basePath . '/normal_final', $basePath . '/normal', $basePath . '/normal_bis', $basePath . '/normal_ter'), $loader->getPaths());
     $this->assertEquals(array($basePath . '/named_final', $basePath . '/named', $basePath . '/named_bis', $basePath . '/named_ter'), $loader->getPaths('named'));
     $this->assertEquals("path (final)\n", $loader->getSource('index.html'));
     $this->assertEquals("path (final)\n", $loader->getSource('@__main__/index.html'));
     $this->assertEquals("named path (final)\n", $loader->getSource('@named/index.html'));
 }
开发者ID:joan16v,项目名称:symfony2_test,代码行数:15,代码来源:FilesystemTest.php

示例4: getSource

 public function getSource($name)
 {
     if (isset($this->templateStrings[$name])) {
         return $this->templateStrings[$name];
     }
     return parent::getSource($name);
 }
开发者ID:omnicolor,项目名称:bulletphp-site,代码行数:7,代码来源:ExtendedFilesystem.php

示例5: getSource

 public function getSource($name)
 {
     if ($name == '@Theme/layout.html') {
         $Theme = \Phpfox_Template::instance()->theme()->get();
         $Service = new \Core\Theme\Service($Theme);
         return $Service->html()->get();
     }
     return parent::getSource($name);
 }
开发者ID:nima7r,项目名称:phpfox-dist,代码行数:9,代码来源:Loader.php

示例6: getSource

 public function getSource($name)
 {
     if ($name == '@Theme/layout.html') {
         $Theme = \Phpfox_Template::instance()->theme()->get();
         $Service = new \Core\Theme\Service($Theme);
         return $Service->html()->get();
     } else {
         if (substr($name, 0, 7) == '@Theme/') {
             $Theme = \Phpfox_Template::instance()->theme()->get();
             $name = str_replace('@Theme/', '', $name);
             $file = $Theme->getPath() . $name;
             if (!file_exists($file)) {
                 $file = PHPFOX_DIR . 'theme/default/html/' . $name;
             }
             $html = file_get_contents($file);
             return $html;
         }
     }
     return parent::getSource($name);
 }
开发者ID:lev1976g,项目名称:core,代码行数:20,代码来源:Loader.php

示例7: getSource

 /**
  * @param string $name
  *
  * @return bool|string
  */
 public function getSource($name)
 {
     $name = $this->getName($name);
     return parent::getSource($name);
 }
开发者ID:vgrish,项目名称:twiggy,代码行数:10,代码来源:twiggyloaderfile.class.php

示例8: getSource

 /**
  * getSource
  *
  * @param string $name
  *
  * @return  string
  */
 public function getSource($name)
 {
     $template = parent::getSource($name);
     return $this->processor->prepareData($template);
 }
开发者ID:bgao-ca,项目名称:vaseman,代码行数:12,代码来源:VasemanTwigLoader.php

示例9: getSource

 /**
  * Get the source of the template, without the front YAML
  *
  * @param string $name Name of the template
  *
  * @return string Source code of the template
  */
 public function getSource($name)
 {
     return $this->parser->parse(parent::getSource($name), false)->getContent();
 }
开发者ID:castlepointanime,项目名称:brancher,代码行数:11,代码来源:FrontYamlLoader.php

示例10: getTemplateSource

 public function getTemplateSource($templateName)
 {
     $loader = new \Twig_Loader_Filesystem($this->getTemplateDirs());
     return $loader->getSource($templateName);
 }
开发者ID:regisg27,项目名称:Propel2,代码行数:5,代码来源:TwigExtension.php


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