I'm working with the sitepackage by Ben Kott for Typo3 9.5 and include content into my fluid template like this:
<f:cObject typoscriptObjectPath="lib.dynamicContent" data="{colPos: '1'}" />
I'm tryin to wrap this into a condition withing fluid like
<f:if condition="<f:cObject typoscriptObjectPath='lib.dynamicContent' data='{colPos: \'1\'}'">
whatever
</f:if>
it does not work though. I can not tell if there's anything wrong syntax or if it's not possible.
{f:cObject(typoscriptObjectPath: 'lib.dynamicContent', data: {colPos: 1}) -> f:variable(name: 'content')}
<f:if condition="{content}">
There is content. Here it is:
{content -> f:format.raw()}
</f:if>
Edit for posterity: the exact reason why the code above failed seems to be a syntax error:
<f:if condition="<f:cObject typoscriptObjectPath='lib.dynamicContent' data='{colPos: \'1\'}'">
Should be:
<f:if condition="<f:cObject typoscriptObjectPath='lib.dynamicContent' data='{colPos: \'1\'}' />">
Since the inner tag was not closed. You should still avoid it though - use inline syntax instead. In the code I put above you can remove the -> f:variable()
part and the expression can then be used as tag attribute value.