[TYPO3-english] TYPO3 News Extension, issue with tx_news.templateLayouts

Thomas Petersen tp at codem.dk
Sun Dec 1 09:46:55 CET 2013


Hi.

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 ?


More information about the TYPO3-english mailing list