Neos\FluidAdaptor\View\StandaloneView::setTemplatePathAndFilename PHP Method

setTemplatePathAndFilename() public method

Sets the absolute path to a Fluid template file
public setTemplatePathAndFilename ( string $templatePathAndFilename ) : void
$templatePathAndFilename string Fluid template path
return void
    public function setTemplatePathAndFilename($templatePathAndFilename)
    {
        $this->baseRenderingContext->getTemplatePaths()->setTemplatePathAndFilename($templatePathAndFilename);
        $partialRootPaths = $this->baseRenderingContext->getTemplatePaths()->getPartialRootPaths();
        $layoutRootPaths = $this->baseRenderingContext->getTemplatePaths()->getLayoutRootPaths();
        array_unshift($partialRootPaths, Files::concatenatePaths([dirname($templatePathAndFilename), 'Partials']));
        array_unshift($layoutRootPaths, Files::concatenatePaths([dirname($templatePathAndFilename), 'Layouts']));
        $this->baseRenderingContext->getTemplatePaths()->setPartialRootPaths($partialRootPaths);
        $this->baseRenderingContext->getTemplatePaths()->setLayoutRootPaths($layoutRootPaths);
    }

Usage Example

 /**
  * Prepare a Fluid view for rendering an error page with the Neos backend
  *
  * @return StandaloneView
  */
 protected function prepareFluidView()
 {
     $fluidView = new StandaloneView();
     $fluidView->setControllerContext($this->runtime->getControllerContext());
     $fluidView->setFormat('html');
     $fluidView->setTemplatePathAndFilename('resource://Neos.Neos/Private/Templates/Error/NeosBackendMessage.html');
     $fluidView->setLayoutRootPath('resource://Neos.Neos/Private/Layouts/');
     // FIXME find a better way than using templates as partials
     $fluidView->setPartialRootPath('resource://Neos.Neos/Private/Templates/TypoScriptObjects/');
     return $fluidView;
 }
All Usage Examples Of Neos\FluidAdaptor\View\StandaloneView::setTemplatePathAndFilename