本文整理汇总了PHP中TYPO3\CMS\Fluid\View\StandaloneView::setTemplateSource方法的典型用法代码示例。如果您正苦于以下问题:PHP StandaloneView::setTemplateSource方法的具体用法?PHP StandaloneView::setTemplateSource怎么用?PHP StandaloneView::setTemplateSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Fluid\View\StandaloneView
的用法示例。
在下文中一共展示了StandaloneView::setTemplateSource方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例2: setTemplate
/**
* Set template
*
* @param array $conf With possibly set file resource
* @return void
* @throws \InvalidArgumentException
*/
protected function setTemplate(array $conf)
{
// Fetch the Fluid template
if (!empty($conf['template']) && !empty($conf['template.'])) {
$templateSource = $this->cObj->cObjGetSingle($conf['template'], $conf['template.']);
$this->view->setTemplateSource($templateSource);
} 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);
}
}
示例3: renderPassesSpecifiedTemplateSourceToTemplateParser
/**
* @test
*/
public function renderPassesSpecifiedTemplateSourceToTemplateParser()
{
$this->view->setTemplateSource('The Template Source');
$this->mockTemplateParser->expects($this->once())->method('parse')->with('The Template Source');
$this->view->render();
}