We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36607 ☆ A M B ☆
    • 44 Posts
    Hi Guys

    Noob query: Anybody able to point out to me how the &tpl_{n} property works?

    Thanks
      • 28215
      • 4,149 Posts
      At every n iterations you can specify a template, eg:

      &tpl_2=`mySecondChunk`

      would say, for the 2nd Resource returned by getResources, use the mySecondChunk as the tpl.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 36607 ☆ A M B ☆
        • 44 Posts
        Thanks Splittingred.

        Was trying to use all kinds of derivations within my getresources call including &tpl_{second}, &tpl_{2}, &tpl_{2nd} etc.

        Did what you suggested and my site works. Not sure that my terminology is correct, but this use of the &tpl_{n} property is a great way of iterating resources from the same parent in circumstances where the output is styled by different css classes.

        This is my snippet call in the main template:

        [[!getResources? &parents=`3` &limit=`4` &tplFirst=`articleheadline` &tpl_2=`articlesnextheadlines1` &tpl_3=`articlesnextheadlines2` &tpl_4=`articlesnextheadlines3` &includeContent=`1` &sortby=`createdon` &showHidden=`1` &sortDir=`DECS`]] 




          • 29839 ☆ A M B ☆
          • 66 Posts
          I would like to know if there is a way to use a tpl every 3de resource returned?