We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24208
    • 17 Posts
    helow all. i am trying to place an element (banner) after first three or five ditto outputs (articles links). please how to change a theme or how to call multiple ditto cals to be able do this. or, how to pu another element after every 5 ditto outputs (articles links). your help is appreciated. thanx for all suggestions.
      • 4172
      • 5,888 Posts
      you can use the ditto-placeholder ditto_iteration together with phx in your ditto-chunk
      example:

      [+ditto_iteration:is=`2`:then=`<p>show banner here</p>`+]


      this would display ’<p>show banner here</p>’ at third ditto-iteration. (because iteration starts with 0)

      for banner on every 5th iteration you can try:

      [+ditto_iteration:math=`?%5`:eq=`0`:then=`<p>show banner here</p>`+]
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 24208
        • 17 Posts
        thenx a lot Bruno smiley . this helps me a lot.
          • 8345
          • 147 Posts
          Thank you so much - I’m almost there!

          I need to get 4 items per row and I made ditto chunk look like this:

          [+ditto_iteration:math=`?%4`:eq=`0`:then=`</ul><ul>`+]
          <li>[+title+]</li>


          And page with ditto call like this:

          <ul>
          [[Ditto? &startID=`0` &tpl=`test_ditto`]]
          </ul>


          The result is:

          <ul> 
          </ul><ul> 
          <li>item1</li> 
          <li>item2</li> 
          <li>item3</li> 
          <li>item4</li>
          </ul><ul> 
          <li>item5</li> 
          <li>item6</li> 
          <li>item7</li> 
          </ul>


          But ideally the result should be:

          <ul> 
          <li>item1</li> 
          <li>item2</li> 
          <li>item3</li> 
          <li>item4</li>
          </ul><ul> 
          <li>item5</li> 
          <li>item6</li> 
          <li>item7</li> 
          </ul>


          So basically it just adds </u><ul> into very beginning, too but it shouldn’t do that. Any idea where I went wrong?

          I have ditto 2.1.0 @ Evolution 1.0.2
            • 8345
            • 147 Posts
            Explored more deeply http://wiki.modxcms.com/index.php/PHx and solved the problem like this:

            [+ditto_iteration:isnot=`0`:and:math=`?%4`:eq=`0`:then=`</ul><ul>`+]


            Thanks again getting me on right place:)