我使用TYPO3 7.6.14的新聞擴展。我想在後端的不同視圖之間切換。TYPO3新聞 - 定義自己的模板
頁TS根:
tx_news.templateLayouts {
Custom = Gesamter Artikel2
}
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:n="http://typo3.org/ns/GeorgRinger/News/ViewHelpers"
data-namespace-typo3-fluid="true">
<f:layout name="General" />
<!--
=====================
Templates/News/List.html
-->
<f:section name="content">
<!--TYPO3SEARCH_end-->
<f:if condition="{news}">
<f:then>
<div class="news-list-view">
<f:if condition="{settings.hidePagination}">
<f:then>
<f:for each="{news}" as="newsItem">
<f:if condition="{0:settings.templateLayout} == {0:'Custom}">
<f:then>
<f:render partial="List/GesamteArtikel" arguments="{newsItem: newsItem, settings:settings, className:className, view:'list'}"/>
</f:then>
<f:else>
<f:render partial="List/Item" arguments="{newsItem: newsItem, settings:settings, className:className, view:'list'}"/>
</f:else>
</f:if>
</f:for>
</f:then>
<f:else>
<n:widget.paginate objects="{news}" as="paginatedNews" configuration="{settings.list.paginate}" initial="{offset:settings.offset,limit:settings.limit}">
<f:for each="{paginatedNews}" as="newsItem" iteration="iterator">
<f:render partial="List/Item" arguments="{newsItem: newsItem,settings:settings,iterator:iterator}" />
</f:for>
</n:widget.paginate>
</f:else>
</f:if>
</div>
</f:then>
<f:else>
<div class="no-news-found">
<f:translate key="list_nonewsfound" />
</div>
</f:else>
</f:if>
<!--TYPO3SEARCH_begin-->
</f:section>
</html>
在那裏我有一個名爲GesamteArtikel.html
我List.html我已經添加了我自己的文件相同的文件夾我究竟做錯了什麼?
編輯:
(文件改變了位置)
我想通了,它沒有任何影響。我把它改成類似於:
<f:then>
<f:for each="{news}" as="newsItem">
<f:if condition="{settings.templateLayout} == 'Custom'">
<f:then>
<f:render partial="GesamteArtikel" arguments="{newsItem: newsItem, settings:settings, className:className, view:'list'}"/>
</f:then>
<f:else>
<f:render partial="GesamteArtikel" arguments="{newsItem: newsItem, settings:settings, className:className, view:'list'}"/>
</f:else>
</f:if>
</f:for>
</f:then>
而且它什麼也沒做。
它採用
<f:else>
<n:widget.paginate objects="{news}" as="paginatedNews" configuration="{settings.list.paginate}" initial="{offset:settings.offset,limit:settings.limit}">
<f:for each="{paginatedNews}" as="newsItem" iteration="iterator">
<f:render partial="List/Item" arguments="{newsItem: newsItem,settings:settings,iterator:iterator}" />
</f:for>
</n:widget.paginate>
</f:else>
然後我把它改爲
<f:else>
<n:widget.paginate objects="{news}" as="paginatedNews" configuration="{settings.list.paginate}" initial="{offset:settings.offset,limit:settings.limit}">
<f:for each="{paginatedNews}" as="newsItem" iteration="iterator">
<f:if condition="{settings.templateLayout} == 'Layout'">
<f:then>
<f:render partial="GesamteArtikel" arguments="{newsItem: newsItem, settings:settings, className:className, view:'list'}"/>
</f:then>
<f:else>
<f:render partial="List/Item" arguments="{newsItem: newsItem, settings:settings, className:className, view:'list'}"/>
</f:else>
</f:if>
</f:for>
</n:widget.paginate>
</f:else>
但隨後它使用的Item.html唯一 如果我告訴兩個if語句使用GesamteArtikel(自定義模板),它會使用它,但我不想重寫舊的item.html。我想用我的自定義佈局,當我在後端選擇它...
您可能還想檢查[本文檔主題](http://stackoverflow.com/documentation/typo3/2196/fluid-templating-in-typo3#t=201703140544357726448)。 – Jost