We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3882
    • 2 Posts
    I am using [[DisplayChildren]] in different sections of my site, and it works great. But is there a way to always keep a particular document at the top of the list? This could be done either within the snippet itself or in a separate call above it -- in the latter case, how would I go about calling the pagetitle and introtext for a document other than the present one? (I know how to use [~ID~] for links to other documents, but beyond that, I’m lost.)

    Hope that’s clear enough -- help?!
      • 24253
      • 125 Posts
      Hi,

      Not sure if [[DisplayChildren]] respects the menuindex flag of documents, but thats how it is supposed to be done
      You can set the menu index for each document when you open it for editing in the manager.

      Hope this is of some help.

      Remon
        • 3882
        • 2 Posts
        Thanks for the tip. My (limited) understanding is that [[DisplayChildren]] sorts on the "createdon" field. This is good for blog-style date-based posting, but if I want direct control over sorting, I imaging I need to use the menu-index as a sort value. I would prefer if there were a kind of binary toggle that would select between placing documents in a "sticky" position or not -- the documents in each position could continue to be sorted separately by createdon. Anyone have thoughts on this? And practical implementation (my coding skills are limited)?
          • 18397
          • 3,250 Posts
          You could easily do this with a TV and some cleverly written code.

          For a similar use of a TV (to add a document to the homepage) check out this thread:

          http://modxcms.com/forums/index.php/topic,590.0.html
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Where is this "DisplayChildren" snippet? The core function getDocumentChildren allows you to pass an argument as to which field you want to sort by, so the snippet should easily be able to do the same. I’d like to take a look at its code.
              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
              • 18397
              • 3,250 Posts
              The DisplayChildren snippet was written for Etomite and (AFAIK) still resides in their snippet library.
                • 25663 MODX Staff
                • 12,272 Posts
                Isn’t the request kinda the same as DropMenu with a level limit of 1?
                  Ryan Thrash, MODX Co-Founder
                  Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me