【问题标题】:TYPO3 News Extension, issue with tx_news.templateLayoutsTYPO3 新闻扩展,tx_news.templateLayouts 问题
【发布时间】:2013-12-01 09:27:15
【问题描述】:

我已经制作了新闻列表的 top3 视图。 (底部)www.codem.dk,我有一个问题,那就是它使用了我的默认 list.html 布局。

我试过这个,但我不能让它工作。

我有 Templates/News/List.html,这里有这段代码。我有关于 templateLayout = 99 的条件,我告诉它使用 Partials/List/ItemTop.html

{namespace n=Tx_News_ViewHelpers}
<f:layout name="General" />
<!--
=====================
Templates/News/List.html
-->

<f:section name="content">
<f:if condition="{news}">
<f:then>
<f:if condition="{settings.templateLayout} == 99">
<f:then>
<ul>
<f:for each="{news}" as="newsItem">
<f:render partial="List/ItemTop" arguments="{newsItem: newsItem, settings:settings}" />
</f:for>
</ul>
</f:then>
<f:else>
<f:if condition="{settings.hidePagination}">
<f:then>
<f:for each="{news}" as="newsItem">
<f:render partial="List/Item" arguments="{newsItem: newsItem, settings:settings}" />
</f:for>
</f:then>
<f:else>
<n:widget.paginate objects="{news}" as="paginatedNews" configuration="{settings.list.paginate}">
<div class="news-list-view">
<ul class="cbp_tmtimeline {newsItem.type}{f:if(condition: newsItem.istopnews, then: ' topnews')}">
<f:for each="{paginatedNews}" as="newsItem">
<f:render partial="List/Item" arguments="{newsItem: newsItem, settings:settings}" />
</f:for>
</ul>
</div>
</n:widget.paginate>
</f:else>
</f:if>
</f:else>
</f:if>
</f:then>
<f:else>
<div class="no-news-found">
<f:translate key="list_nonewsfound" />
</div>
</f:else>
</f:if>
</f:section>

然后我有 Partials/List/ItemTop.html 页面,其中包含此代码。

{namespace n=Tx_News_ViewHelpers}
<n:excludeDisplayedNews newsItem="{newsItem}" />
<li>
<n:link newsItem="{newsItem}" settings="{settings}">
{newsItem.title}
</n:link>
<span class="post-date"><n:format.date format="{f:translate(key:'dateFormat')}">{newsItem.datetime}</n:format.date></span>
</li>

然后我在我的 Page TS 配置代码中,在隐藏的 SYS 文件夹中,显示 top3 新闻。

tx_news.templateLayouts {
99 = Top 3 News layout
}

但我可以看到它仍在使用默认 Partials/List/Item.html 页面中的布局代码,这里有什么问题?

【问题讨论】:

    标签: typo3 typoscript typo3-6.1.x


    【解决方案1】:

    第一步,让模板输出

    {settings.templateLayout}

    看看是不是真的是99。我猜不是。您是否仅在 PageTS 中设置了布局 99 的可能性?也许您忘记在新闻插件中选择此布局。

    【讨论】:

    • 嗨洛伦兹。我按照手册docs.typo3.org/typo3cms/extensions/news/Main/Templating/… 没有看到我需要从插件/模板选项卡中选择模板的任何地方,然后是“模板布局”,但我现在从该下拉列表中选择了“前 3 名新闻布局”,并且这是工作。谢谢。但在手册中没有看到我需要那个“步骤”。
    猜你喜欢
    • 2018-11-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多