[TYPO3-mvc] Determine f:layout dynamically

Dominic Garms djgarms at gmail.com
Thu Oct 10 13:50:29 CEST 2013


On 10/10/2013 07:37 PM, Markus Klein wrote:
> Hi!
>
> Is it not possible to have the layout of a template defined dynamically?
>
> <f:layout name="{f:if(condition: isSomething, then:'This', else:'That')}" />
>
> This code gives Fatal in FE:
> Fatal error: Call to a member function getViewHelper() on a non-object in /.../master/typo3temp/Cache/Code/fluid_template/Standalone_template_source_d2e755f13089ffbbf3d3e22e204bf68593c7d8fb.php on line 18
>
> Line 18 uses $self which is not defined in function 'getLayoutName'.
>
> Any idea how to solve that, or is this even a core bug?
> Tested on current master.
>
> Kind regards
> Markus
>
> ------------------------------------------------------------
> Markus Klein
> TYPO3 CMS Active Contributors Team Member
>
>
Hi Markus,

Why you don't call the specific section inside of your layout through a 
submitted variable? I would recommend this over your approach to render 
a specific layout. But you have for sure a cache conflict so just clean 
up your typo3temp/Cache folder.

layout.html
<f:render section="{section}" />

template.html
<f:section name="A">
(...)
</f:section>

<f:section name="B">
(...)
</f:section>

Cheers Dominic


More information about the TYPO3-project-typo3v4mvc mailing list