We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3504
    • 11 Posts
    there is a way to use a diferent template for the 6th listed element with ditto? like with tplFirst, tplLast ...
      • 26016
      • 561 Posts
      Hi,
      That’s an intriguing question. You could do it by having a conditional statement in the call using PHx - when a condition arises, use a different template.

      What I would do is simpler - use the Doc ID to make a CSS class, and then style it. In the template I could have this bit of code:

      <div class="[+id+]">...

      That would give me a different class for each element. Then I make note of what class the sixth item has, and style it accordingly to make it look different. That’s not automated, of course.

      I hope that gives you some ideas.
      Cheers, Dave
        MODx and Wordpress development
        Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4
        • 22303 MODX Staff
        • 10,725 Posts
        If using Revolution, you could use getResources which let’s you specify tpl’s for specific result indices, i.e. &tpl_6=`sixthItemTpl`, or you could back port the logic of getResources to an Evolution compatible Snippet to accomplish the same.
          • 26931
          • 2,314 Posts
            • 3504
            • 11 Posts
            Thank all of you the answers.
            For the 6th element the template is very different, adding a class can’t help me.
            The phx has to go the chunck and loading from the ditto tpl a different chunks just doesnt seem to get the data ... I did with phx something like if 6n element chunk6 else chunkBasic

            The Revolution thing sounds exciting, I’ll see what can I do with the idea for Evolution
              • 26931
              • 2,314 Posts
              e.g.:
              [[Ditto? &parents=`123` &tpl=`iteration` ]] 


              Ditto template {{iteration}}:
              [+ditto_iteration:math=`(?+1)%6`:is=`0`:then=`<div class="sixth-tpl">[+pagetitle+]</div>`:else=`<div class="everyother-tpl">[+pagetitle+]<br />[+createdon+]</div>`+]
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Couldn’t you just use the [+ditto_iteration+] placeholder as part of an ID, then style the 6th one in the CSS?
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org