We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28451
    • 46 Posts
    Hello all,

    I’m a new MODx user, and I’m loving it so far.

    I’ve been able to find help for everything I’ve wanted to do, but this one I can’t find, or figure out on my own.

    I have a Ditto call, where I get my list of news. Now I’d like to style every second news-item differently, I want to do a background in CSS. My problem is, how do I identify every second news-item?

    Thankyou in advance.
      • 22548
      • 58 Posts
      Hi there!
      This is a tip from the German forum (http://www.modxcms.de/forum/comments.php?DiscussionID=393&page=1#Item_0 :

      If you do not want to do it with phx you can just make two chunks called Tabelle and Tabelle_Alt (in this case)

      - Tabelle:
      <tr>
      <td class="tabstyle"><a href="[~[+id+]~]">[+title+]</a></td>
      </tr>

      - Tabelle_Alt:
      <tr>
      <td class="tabstyle_alt"><a href="[~[+id+]~]">[+title+]</a></td>
      </tr>

      Then you just add these to your ditto call and you’re done:
      [[Ditto? &tpl=`Tabelle` &tplAlt=`Tabelle_Alt`]]

      I did not test this, however, and maybe you would prefer to do it with Javascript.
      Greetings, Alex
        • 28451
        • 46 Posts
        &tplAlt was what I was missing, that’s perfect! Can’t believe I didn’t notice that one...

        Thankyou for your reply.
          • 22548
          • 58 Posts
          You’re welcome! And have lots of fun with MODx!
          Alex
            • 33002
            • 17 Posts
            Thx too.

            Quote from: Steffen.Larsen at Oct 18, 2007, 03:39 AM

            &tplAlt was what I was missing, that’s perfect! Can’t believe I didn’t notice that one...

            Ah...it’s "tplAlt" and not "tplAltRows", which I found in another thread and (I think so) even within the documentation.

            Quite confusing.
              ...whatever...