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


PHP StandaloneView::setTemplateRootPaths方法代码示例

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


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

示例1: setTemplate

 /**
  * Set template
  *
  * @param array $conf With possibly set file resource
  * @return void
  * @throws \InvalidArgumentException
  */
 protected function setTemplate(array $conf)
 {
     // Fetch the Fluid template by templateName
     if (!empty($conf['templateName']) && !empty($conf['templateRootPaths.']) && is_array($conf['templateRootPaths.'])) {
         $templateRootPaths = array();
         foreach ($conf['templateRootPaths.'] as $key => $path) {
             if (strpos($key, '.') === false) {
                 $templateRootPaths[$key] = isset($conf['templateRootPaths.'][$key . '.']) ? GeneralUtility::getFileAbsFileName($this->cObj->stdWrap($conf['templateRootPaths.'][$key], $conf['templateRootPaths.'][$key . '.'])) : GeneralUtility::getFileAbsFileName($path);
             }
         }
         $this->view->setTemplateRootPaths($templateRootPaths);
         $templateName = isset($conf['templateName.']) ? $this->cObj->stdWrap($conf['templateName'], $conf['templateName.']) : $conf['templateName'];
         $this->view->setTemplate($templateName);
         // Fetch the Fluid template by template cObject
     } elseif (!empty($conf['template']) && !empty($conf['template.'])) {
         $templateSource = $this->cObj->cObjGetSingle($conf['template'], $conf['template.']);
         $this->view->setTemplateSource($templateSource);
         // Fetch the Fluid template by file stdWrap
     } else {
         $file = isset($conf['file.']) ? $this->cObj->stdWrap($conf['file'], $conf['file.']) : $conf['file'];
         /** @var $templateService \TYPO3\CMS\Core\TypoScript\TemplateService */
         $templateService = $GLOBALS['TSFE']->tmpl;
         $templatePathAndFilename = $templateService->getFileName($file);
         $this->view->setTemplatePathAndFilename(PATH_site . $templatePathAndFilename);
     }
 }
开发者ID:hlop,项目名称:TYPO3.CMS,代码行数:33,代码来源:FluidTemplateContentObject.php

示例2: setTemplateWalksStringKeysInReversedOrder

 /**
  * @test
  */
 public function setTemplateWalksStringKeysInReversedOrder()
 {
     $this->view->setTemplateRootPaths(array('default' => 'some/Default/Directory', 'specific' => 'specific/Templates', 'verySpecific' => 'evenMore/Specific/Templates'));
     $this->mockRequest->expects($this->any())->method('getFormat')->will($this->returnValue('html'));
     $this->view->expects($this->at(0))->method('testFileExistence')->with(PATH_site . 'evenMore/Specific/Templates/Template.html')->will($this->returnValue(false));
     $this->view->expects($this->at(1))->method('testFileExistence')->with(PATH_site . 'evenMore/Specific/Templates/Template')->will($this->returnValue(false));
     $this->view->expects($this->at(2))->method('testFileExistence')->with(PATH_site . 'specific/Templates/Template.html')->will($this->returnValue(false));
     $this->view->expects($this->at(3))->method('testFileExistence')->with(PATH_site . 'specific/Templates/Template')->will($this->returnValue(false));
     $this->view->expects($this->at(4))->method('testFileExistence')->with(PATH_site . 'some/Default/Directory/Template.html')->will($this->returnValue(false));
     $this->view->expects($this->at(5))->method('testFileExistence')->with(PATH_site . 'some/Default/Directory/Template')->will($this->returnValue(true));
     $this->view->setTemplate('Template');
     $this->assertEquals(PATH_site . 'some/Default/Directory/Template', $this->view->getTemplatePathAndFilename());
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:16,代码来源:StandaloneViewTest.php

示例3: __construct

 /**
  * Class constructor
  * Sets up view and property objects
  *
  * @throws InvalidTemplateResourceException In case a template is invalid
  */
 public function __construct()
 {
     $this->view = GeneralUtility::makeInstance(StandaloneView::class);
     $this->view->setPartialRootPaths($this->partialRootPaths);
     $this->view->setTemplateRootPaths($this->templateRootPaths);
     $this->view->setLayoutRootPaths($this->layoutRootPaths);
     $this->view->setTemplate($this->templateFile);
     $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
     $this->docHeaderComponent = GeneralUtility::makeInstance(DocHeaderComponent::class);
     $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
 }
开发者ID:Gregpl,项目名称:TYPO3.CMS,代码行数:17,代码来源:ModuleTemplate.php

示例4: __construct

 /**
  * Constructor
  */
 public function __construct()
 {
     $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
     $this->moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class);
     $this->presetRepository = GeneralUtility::makeInstance(PresetRepository::class);
     $templatePath = ExtensionManagementUtility::extPath('impexp') . 'Resources/Private/';
     /* @var $view StandaloneView */
     $this->standaloneView = GeneralUtility::makeInstance(StandaloneView::class);
     $this->standaloneView->setTemplateRootPaths([$templatePath . 'Templates/ImportExport/']);
     $this->standaloneView->setLayoutRootPaths([$templatePath . 'Layouts/']);
     $this->standaloneView->setPartialRootPaths([$templatePath . 'Partials/']);
     $this->standaloneView->getRequest()->setControllerExtensionName('impexp');
 }
开发者ID:burguin,项目名称:test01,代码行数:16,代码来源:ImportExportController.php

示例5: setView

 /**
  * Set the view
  *
  * @param array $templateRootPaths The template root paths
  */
 protected function setView($templateRootPaths)
 {
     $this->view = GeneralUtility::makeInstance(StandaloneView::class);
     $this->view->setTemplateRootPaths($templateRootPaths);
 }
开发者ID:patrickbroens,项目名称:TYPO3.pbsurvey,代码行数:10,代码来源:PageControl.php


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