[TYPO3-mvc] Fluid: Render custom template in current context to be able to use layouts

Franz Koch typo3.RemoveForMessage at elements-net.de
Wed Jul 21 11:51:14 CEST 2010


Hey there,

> Am 20.07.2010 16:43 Uhr, schrieb roberto blanko:
>> // If certain template was specified, use it
>> if ($this->settings['templateName']) {
>> return $this->view->render($this->settings['templateName']);
>> }
>
> I haven't tested it but try to use
>
> if ($this->settings['templateName']) {
> $this->view->setTemplatePathAndFilename('path/to/templateFile');
> }

problem with this is, that you won't have a valid FLUID view in extbase 
if you don't provide a template with the name of the action. So you can 
only override the templatePathAndFilename if you have a dummy template 
with your action name, unless you write your own 'resolveView' method 
and prevent extbase from switching to the defaultView object if no 
template was found.

Had a similar requirement recently. Maybe we need a way to have that 
more flexible and don't assign a dummy viewObject but just a dummy 
template if no proper template was found. Not sure if this would have 
any drawbacks when thinking of other template engines that might require 
different template formats.
But I wonder if we need a fallback anyway and not just can have no 
template assigned and throw a exception or something instead when the 
view renders.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list