phptypo3typoscripttypo3-8.xtt-news

typo3 tt_news configurate list template


I use tt_news plugin for displaying news. There is such list template

<!-- ###TEMPLATE_LIST### begin -->
<div class="col-md-9">
    <!-- ###CONTENT### begin -->
    <!-- ###NEWS### begin -->
   <div class="single-post-item wow fadeInLeft" style="visibility: visible; animation-name: fadeInLeft;">
       <div class="row mt-4">
           <div class="col-6">
               <h5><span class="border-btm">###NEWS_AUTHOR###</span></h5>
           </div>
           <div class="col-6 text-right">
               <span class="exclu fw-700 text-uppercase bg-red text-white">Exklusiv</span>
           </div>
       </div>
       <div class="row">
           <div class="col-12">
               <div class="post-contents">
                   <h2 class="mb-4">###NEWS_TITLE###</h2>
                   <div class="row">
                       <div class="col-md-6"><!--###LINK_ITEM###-->###NEWS_IMAGE###<!--###LINK_ITEM###--></div>
                       <div class="col-md-6">
                           <p class="m-0 mt-3 mt-md-0">###NEWS_SUBHEADER###
                               <!--###LINK_ITEM###-->mehr...<!--###LINK_ITEM###-->
                           </p>
                       </div>
                   </div>

               </div>
           </div>
       </div>
   </div>
    <!-- ###NEWS### end-->
    <!-- ###CONTENT###  end -->
    ###BROWSE_LINKS###
</div>
<!-- ###TEMPLATE_LIST### end -->

I need to have a different design for the first list element and forth as an example. But there is no loop there and I can't check the number of iterations. Any ideas how can I do it? TYPO3 8.7, thx in advance


Solution

  • Have a look into the manual and search for alternatingLayouts:

    Indicates how many alternating designs the news-script should expect in the html-template.

    Example: If you define a subpart like: "<!--###NEWS###--> ... <!--###NEWS###-->" this is used all the time. If you define a similar subpart: "<!--###NEWS_1###--> ... <!--###NEWS_1###-->" which might show another set of colors, this is used every second time instead of the default! This is because "alternateLayouts" is set to 2. If you define a similar subpart "<!--###NEWS_2###--> ... <!--###NEWS_2###-->" ... this will be used every third time IF (!) "alternateLayouts" is set to 3. If you do not set it to 3, the first two aternating designs will be used only.

    tt_news manual

    If you want a different template not for each n-th news, but only for the first/second/..., then have also a look at altLayoutsOptionSplit:

    OptionSplit for template parts (altLayoutsOptionSplit) allows you to directly access certain template parts in a template. Contrary to the good old “alternatingLayouts” feature the current template part is not determined by a simple counter but by an optionsplitted value. Blockquote

    tt_news Documentation - changes in tt_news 3.0.0