We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13555
    • 5 Posts
    I need help with a loop. I want to output this content through a "while" or a "for" loop (into a table) that
    looks for documents in the FolderMain folder.

    FolderMain (id=30)

    SubPage 1 (id=14)
    SubPage 2 (id=33)
    SubPage 3 (id=11)

    Please, does anyone have an idea? I don’t want it to output those specific IDs above since they can differ in my case. So some kind of loop that checks the FolderMain for document IDs

    Cheers
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You can use Ditto; make up whatever HTML layout you want for the items in a custom chunk template for the Ditto output. Simply set the menu index of the individual pages to have them in the order you want. I also believe you can use other fields to order the output, if you want it by Page Title, for example.
        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
        • 13555
        • 5 Posts
        Yeah thanks, that solved it. So this is how I did it. I wanted to link the output aswell, keep that in mind.

        1. Create a template (called "dittoTemplate" in this case) containing this:
        <a href="index.php?id=[+id+]">[+title+]</a><br>
        


        2. On the output page:
        [[ditto? &parents=`50` &tpl=`dittoTemplate`]]
        

        I put this call inside a table cell (<td>-tag).

        It worked fine to do it this way. There’s probably other ways too, but I like the way it turned out. Thanks again!