We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 52497
    • 1 Posts
    Hey guys,

    I have a parent resource 3171 that has three child resources. I am trying to create a comma-separated list of page titles however why my logic below I am getting the following:

    pagetitle1, pagetitle2, pagetitle3,

    [[!getResources?
     &parents=`3171`
     &showHidden=`1`
     &showUnpublished=`1`
     &tpl=`@INLINE [[!+pagetitle]][[!+idx:lt=`[[!+total]]`:then=`, `:else=``]]`
    ]]
    


    With my logic above I've outputted the idx and the total and when idx = 3 and total = 3 that conditional is still evaluating true. I've been searching around for a potential answer but have failed so far. Obviously I'm missing something but I'm not sure what. Any ideas?

    This question has been answered by Bruno17. See the first response.

    • discuss.answer
      • 4172
      • 5,888 Posts
      [[+total]]
      can only get parsed, after getResources has run, not within the tpl.

      [[+idx]]
      with an output-filter will only work in a real tpl-chunk, not with @INLINE

      try

      &outputSeparator=`,`
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!