[TYPO3-mvc] Determine f:layout dynamically
Anja Leichsenring
aleichsenring at ab-softlab.de
Thu Oct 10 14:30:56 CEST 2013
Hi Markus,
I solve it like this:
TypoScript:
page.10 = FLUIDTEMPLATE
page.10 {
template = FILE
template.file = {$page.pathToTemplateRoot}fluid/Templates/xxx.html
layoutRootPath = {$page.pathToTemplateRoot}fluid/Layouts/
partialRootPath = {$page.pathToTemplateRoot}fluid/Partials/
variables {
backendLayout = CASE
backendLayout {
key.data = levelfield:-1,backend_layout_next_level,slide
key.override.field = backend_layout
default = TEXT
default.value = no_layout_set
1 = TEXT
1.value = LayoutHomepage
2 = TEXT
2.value = LayoutSubpage
}
settings {
}
}
}
Fluid Template:
<f:layout name="{backendLayout}"/>
Greetings Anja
On 10/10/2013 01: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
>
>
More information about the TYPO3-project-typo3v4mvc
mailing list