在FCE中访问已翻译的标题失败

时间:2018-01-03 17:13:57

标签: fluid typo3-8.x

我有一个Typo3页面,上面有几个包装器和引用元素。

我使用flux-grid创建包装器的内容,然后像这样访问它:

<v:variable.set name="contentElements" value="{flux:content.get(area:'content', render:'FALSE')}" />

            <ul class="myClass">
                <f:for each="{contentElements}" as="contentElement" iteration="iteration">

                    <li>
                        <h3 data-number="{iteration.cycle}"><a href="#acc_{v:format.sanitizeString(string: '{contentElement.header}')}" class="toggle">{contentElement.header}</a></h3>
                        <ul class="content" id="acc_{v:format.sanitizeString(string: '{contentElement.header}')}">
                            <li>
                                <v:content.render contentUids="{0:contentElement.uid}" />
                            </li>
                        </ul>
                    </li>
                </f:for>
            </ul>

问题是,我总是得到contentElement.header的默认语言而不是翻译版本。通过v:vcontent.render获取的内容本身以正确的语言显示。

我做错了什么?

(Typo3 8.7.9)

1 个答案:

答案 0 :(得分:0)

我必须首先获取内容,然后单独渲染:

<f:for each="{contentElements}" as="contentElement" iteration="iteration">
                <v:variable.set name="head" value="{v:content.get(contentUids: '{0: contentElement.uid}', render:'0')}" />

                    <v:variable.set name="theContent" value="{v:content.get(contentUids: '{0: head.0.records}', render:'0')}" />

                    <li>
                        <h3 data-number="{iteration.cycle}"><a href="#acc_{v:format.sanitizeString(string: '{theContent.0.header}')}" class="toggle">{theContent.0.header}</a></h3>
                        <ul class="content" id="acc_{v:format.sanitizeString(string: '{theContent.0.header}')}">
                            <li>
                                <f:format.raw>{theContent.0.bodytext}</f:format.raw>
                            </li>
                        </ul>
                    </li>
                </f:for>

希望它有所帮助...