Question

I have made a top3 view of the news list. (se bottom) www.codem.dk, i have a problem, and thats that it using my default list.html layout.

I have tried this, but i can't get it to work.

I have Templates/News/List.html and here i have this code. where I have the condition about the templateLayout = 99 and where i tell it to use 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>

Then i have the Partials/List/ItemTop.html page, that have this code.

{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>

Then I have this in my Page TS config code, on the hidden SYS folder, thats show the top3 news.

tx_news.templateLayouts {
99 = Top 3 News layout
}

But i can see it's still using the layout code from the default Partials/List/Item.html page, whats wrong here ?

Was it helpful?

Solution

As a first step, just let a template output

{settings.templateLayout}

to see if it is really 99. I guess it is not. Did you only set the possibility to have a layout 99 in PageTS? Maybe you forgot to select this layout in the News Plugin.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top