We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6998
    • 25 Posts
    Hi,
    I have a Ditto call that has a regular template (for stuff in the middle), one for first item, and one for last item.

    Is there any way I can specify what to do when there is just one item? Because it then needs to have a title from the first item template but not have a comma at the end, like the last item template.

    Any suggestions?

    Thanks!

    EDIT: Sorry, solved it with PHx to add the first item title instead of the tplFirst.
      • 23718
      • 15 Posts
      Hello delorean88

      I have the same problem, but I never used PHx. undecided
      Can you explain me how you have resolved this?

      Thx in advance.
        • 6998
        • 25 Posts
        Instead of using tplFirst, I used PHx to check if the template variable I was making the ditto list from was not empty. If the variable was not empty, it placed the title and initiated the ditto list. Here’s the code if it helps:
        [+phx:if=`[*related*]`:ne=``:then=`See related: 
         [!Ditto? &documents=`[*related*]` &tpl=`dittorelated` &tplLast=`dittorelatedlast` &noResults=` `!]`+]
        


        Best of luck!
          • 23718
          • 15 Posts
          grin

          Of course it helps me! You solve my problem! I must learn tu use PHx, so powerful.

          Many Thanks!