Reputation: 488
I was following this tutorial and came across a problem: https://wiki.typo3.org/T3Doc/Fluidtemplate_by_example#The_Layout-Switch
The partial should be rendered twice. However, only the first partial is rendered. The second one, having the "lib.menu" as argument, is not rendered.
Template:
<f:section name="pageInfoBoxes">
<f:render partial="Colorbox" arguments="{boxHeader : 'Abstract', boxContent : '{data.title}', boxColor : 'blue'}" />
<f:render partial="Colorbox" arguments="{boxHeader : 'Subpages', boxContent : '{f:cObject(typoscriptObjectPath:'lib.menu')->f:format.raw()}', boxColor : 'red'}" />
</f:section>
Partial (colorbox.html):
<div class="box box-{boxColor}">
<h3>{boxHeader}</h3>
<div class="contains">
{boxContent}
</div>
</div>
Layout:
<header>
<h1>
<f:link.page pageUid="67" title="Nuremberg Shop">Nuremberg Shop</f:link.page>
</h1>
<f:render section="topMenu" />
</header>
<div class="row">
<div class="span8">fileadmin/.../Layouts/
<f:render section="content"/>
</div>
<div class="span4">
<f:if condition="{contentRight}">
<f:then><f:render section="contentRight"/></f:then>
<f:else><f:render section="pageInfoBoxes"/></f:else>
</f:if>
</div>
</div>
<footer>
<!-- here some stuff for footer... -->
</footer>
I can't figure out why this line is not rendered correctly:
<f:render partial="Colorbox" arguments="{boxHeader : 'Subpages', boxContent : '{f:cObject(typoscriptObjectPath:'lib.menu')->f:format.raw()}', boxColor : 'red'}" />
I tried different syntaxes, with no luck.
Upvotes: 0
Views: 567
Reputation: 789
Two things of note:
First, when you have something like the following,
boxContent: '{f:cObject(typoscriptObjectPath:'lib.menu')->f:format.raw()}'
you have to escape the inner quotes with a backslash:
boxContent: '{f:cObject(typoscriptObjectPath:\'lib.menu\')->f:format.raw()}'
There isn't really any good way in fluid to prevent these cases, especially if you nest it even further. Though you could use the f:variable ViewHelper to set a temporary variable and use that as boxContent argument instead.
The second part, that you mentioned in your comments:
You have to apply the f:format.raw at the location where you output your boxContent.
So it should instead be something like:
boxContent: '{f:cObject(typoscriptObjectPath:\'lib.menu\')}'
and in the partial you do:
{boxContent -> f:format.raw()}
The ViewHelpers have an option to disable the escaping interceptor, but that only works, if the result of the viewhelper is printed directly. If you store the result in a variable and output the variable later, the escaping still applies to the output of the variable.
Upvotes: 1