We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33997
    • 150 Posts
    Is there a way to add into GetResources or Ditto that every 4 or 5 entries, it puts in advertisements? In other words:
    Entry 1
    Entry 2
    Entry 3
    Entry 4
    Ad 1 | Ad 2
    Entry 5

    Etc.

    ?? Thanks!
      "Great spirits have always encountered violent opposition from mediocre minds." -Albert Einstein
      • 33968
      • 863 Posts
      Have a look at using tpl_{n} - see the getResources docs.

      In this case, your tpl_{5} chunk will include two list items, the first holding your advertisement. Cool huh?
        • 33997
        • 150 Posts
        Very cool. And the ones in between don’t need to be set, right? It will use the default tpl for the first 4, and then change for the 5th, and then the default for the next 4, etc?

        Also, is there anything similar for Ditto?

        Thanks!
          "Great spirits have always encountered violent opposition from mediocre minds." -Albert Einstein
          • 26931
          • 2,314 Posts
          for Ditto you could use ’ditto_iteration:math’ e.g. http://modxcms.com/forums/index.php?topic=47258.0
            • 3749
            • 24,544 Posts
            Quote from: lucas at Jun 10, 2011, 04:39 PM

            Have a look at using tpl_{n} - see the getResources docs.

            In this case, your tpl_{5} chunk will include two list items, the first holding your advertisement. Cool huh?

            Note that the curly braces are not part of the Tpl chunk name, so it should be tpl_5.
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 33968
              • 863 Posts
              Thanks Bob - and thanks Mark H for updating the docs smiley

              @goonz - yes the default ’tpl’ chunk applies to the other rows, while row ’5’ will use the tpl_5 chunk. I admit I haven’t actually tried it out, so not sure if it applies to row 5 only or multiples of 5 (5,10,15,etc)
                • 5143
                • 116 Posts
                ...not sure if it applies to row 5 only or multiples of 5 (5,10,15,etc)

                It will apply to every 5th instance - I’ve used it successfully when populating a grid (ul) of links and thumbnails - the last one in each row uses the (in my case) tpl_4 chunk.
                  • 33997
                  • 150 Posts
                  All a great help, thanks to everyone who contributed.
                    "Great spirits have always encountered violent opposition from mediocre minds." -Albert Einstein