We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22770
    • 285 Posts
    So, I’ve got a ditto call where I’d like the first item to use a different chunk to the rest of the items. But I also need the call to ignore the first three items. My ditto call includes the following:

    &start=`3` &tplFirst=`eventsListTplFirst` &tpl=`eventsListTpl`


    The problem is, ditto appears to apply the different chunk to the first item before it skips the first three items. So, the first item that actually appears in the list uses the normal &tpl chunk rather than the &tplFirst chunk. Anyone know any way around this?
      • 18397
      • 3,250 Posts
      What version of Ditto are you using? What server environment is this running on?
        • 22770
        • 285 Posts
        I’m using ditto 2.03. Not sure about the server environment other than it’s a UNIX environment running PHP 5.1.2. I email customer support and see if I can find out more.
          • 22770
          • 285 Posts
          Also been told it’s Apache 2.0.58.

          I’m afraid my knowledge of hosting stuff is minimal. sad
            • 18397
            • 3,250 Posts
            Does the same problem occur with 2.1b3?
              • 22770
              • 285 Posts
              I haven’t tried it, I must admit. It’s a live environment, and I’m reluctant to experiment too much! Is 2.1b3 stable?
                • 18397
                • 3,250 Posts
                Yes
                  • 22770
                  • 285 Posts
                  Curiously, without me doing anything, this appears to have started working.

                  Computers are curious things... smiley
                    • 22770
                    • 285 Posts
                    No, it appears I spoke to soon.

                    I have two identical ditto calls on different pages, but calling to different folders. However, one returns three results and one returns one result. The one that returns three results works fine, but the one that returns a single result doesn’t.

                    The ditto call contains:

                    &start=`3` &tplFirst=`eventsListTplFirst` &tplLast=`eventsListTplLast` &tpl=`eventsListTpl`


                    What seems to be happening is that, where there is only a single result, &tplLast takes precedence over &tplFirst and over &tpl and so I don’t get the html associated with &tplFirst.

                    So, because &tplFirst contains the following:

                    <h3>Further Events</h3>
                    <ul>
                    <li><a href="[~[+id+]~]" title="[+pagetitle+]">[+pagetitle+]</a></li>


                    and &tplLast contains:

                    <li><a href="[~[+id+]~]" title="[+pagetitle+]">[+pagetitle+]</a></li>
                    </ul>


                    when there is only a single result returned, I don’t get the heading or the beginning <ul> of the list.

                    I can get around that by leaving out &tplLast and then putting the </ul> outside of the ditto call, but then if I have zero results returned, I have a dangling </ul>.

                    So, I misdiagnosed the problem in the original question. &start isn’t to blame. It’s trying to get the html contents of &tplFirst and &tplLast in a list with a single item.

                    Anyone suggest any solutions?
                      • 7231
                      • 4,205 Posts
                      I usually put the <ul> tags around the ditto call <ul>[!Ditto?...!]</ul> when I use it to build a list. Wayfinder works better for list building because of the layered tpl structure but I don’t think that it can skip the first 3.

                      Here is an idea for making wayfinder filter the first 3 docs; you could use the &excludeDocs to not display the first 3. You would need a snippet that would get the ID for the first 3 and return a comma separated list.

                      &excludeDocs
                      default: 0
                      values: [ comma-delimited list of document ids ]
                      description: Acts as a filter and will remove the documents specified in this parameter from the output. The startId is still required.
                        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                        Something is happening here, but you don&#39;t know what it is.
                        Do you, Mr. Jones? - [bob dylan]