1

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

Peter Kraume
  • 3,577
  • 2
  • 21
  • 39
V-K
  • 1,297
  • 10
  • 28

1 Answers1

2

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

Julian Hofmann
  • 2,081
  • 1
  • 8
  • 16
  • thx, great option, but I need not every second element, but only "first" second element – V-K Nov 14 '19 at 14:40
  • 1
    Ok, then optionSplit (respectively `altLayoutsOptionSplit`) should help. The documentation contains a section on this (page 13): https://github.com/rupertgermann/tt_news/blob/master/Documentation/tt_news_3.0_changes.sxw – Julian Hofmann Nov 14 '19 at 15:41
  • thx, please add this to your answer, and I will mark it as right one – V-K Nov 14 '19 at 17:23