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