We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23428
    • 27 Posts
    I want to show every post apart from the latest which I'm showing elsewhere on the page using ditto. So if i use $display='all'; in the config file it shows everything, but how would I change that to show everything apart from the latest one?

    Thanks!
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Use the &start or &offset properties; this will tell it how many to skip.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 23428
        • 27 Posts
        Quote from: sottwell at Aug 08, 2013, 12:42 PM
        Use the &start or &offset properties; this will tell it how many to skip.

        Thanks; not sure how to use it though; have tried different values in this code but doesn't work:

        <?
        $parents='72';
        $tpl = '@CODE <li><img class="left1" src="[+image+]" alt="" width="135" height="135" /><span class="green">[+longtitle+]</span><br />[+summary+] <a href="[~[+id+]~]" title="[+title+]"><br />[+link+]</li><div class="clearer"></div>';
        $display='all';
        $offset='0';
        $showPublishedOnly='1';
        ?>


        What should the value '0' be in the offset parameter so that whatever the latest post is, it's not shown in the list? Thanks!
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          If you want it to skip the first one, then &offset would be 1.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 23428
            • 27 Posts
            Quote from: sottwell at Aug 09, 2013, 03:47 AM
            If you want it to skip the first one, then &offset would be 1.

            hmm yes i tried that but still shows it. weird. does it matter what order the other parameters are?
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Try &start=`1` instead. The docs indicated that &offset was the same as &start, but &offset didn't work on my tests, while &start does.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 23428
                • 27 Posts
                Quote from: sottwell at Aug 09, 2013, 04:11 AM
                Try &start=`1` instead. The docs indicated that &offset was the same as &start, but &offset didn't work on my tests, while &start does.

                Aha yes that works!! Thanks very much for you help smiley