We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23853
    • 8 Posts
    Hi

    How can one list all the documents in a folder with ditto? I have the following structure for my site:

    Journal (main category)
    -volume 1
    --article a
    --article b
    -volume 2
    --article c
    --article d
    --artice e

    etc.

    Now, I would like to have a main journal page where the latest volumes with the list of articles will be listed and this page will be paginated, so that past volumes can also be browsed.
    when I use Ditto, I only get the first children of the folder ’Journal’, i.e ’volume1’, ’volume2’
    how can I get the above list with each volume and articles within that volume followed by next volume etc.

    I know I can create this as a menu, but this should be an ’archive’ and not a menu, where when I have 30 volumes, I’ll be able to display the list of volumes on different pages and not a huge list on a single page.

    Please could anyone give me any suggestions? Let me know if the problem is not clear and I try to write it better.
    I will very much appreciate any feedback on this, as I am trying since days

    thanks
      • 18397
      • 3,250 Posts
      &depth=`2` will tell Ditto to retrieve documents 2 levels deep in the document tree.
        • 10449
        • 956 Posts
        Try something like this:

        [!Ditto? &parents=`0` &depth=`4` &total=`999` &display=`all` &sortBy=`createdon` &sortDir=`DESC` &hideFolder=`1` &summarize=`10` &paginate=`1` &paginateAlwaysShowLinks=`1` &paginateSplitterCharacter=`|`!]
        
        <p>Showing <strong>[+start+]</strong> - <strong>[+stop+]</strong> of <strong>[+total+]</strong> Articles | Page <strong>[+currentPage+]</strong> of <strong>[+totalPages+]</strong> </p> <div id="ditto_pages"> [+previous+] [+pages+] [+next+] </div> 
        


        http://ditto.modxcms.com/tutorials/pagination.html

        Obviously, change the parents parameter accordingly. You can use multiple ids, separated by commas.
          • 23853
          • 8 Posts
          thanks both of you

          but this doesn’t really solve my problem, because although with ’depth’ I can pull out also the articles, I cannot keep the hierarchy like this:

          -volume 1(subfolder level1)
          --article (level2)
          --article (level2)
          -volume 2(level 1)
          --article
          --article
          --article

          Instead the article written/published last is listed before the folder. The articles should be grouped/sorted by their parents, which should be grouped by their parent etc.

          do you see what I mean?
            • 7231
            • 4,205 Posts
            I was only able to get this parent/sub grouping with multiple embedded Ditto calls which would destroy the pagination, I think. I am not sure if Ditto supports grouping?
              [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]
              • 18397
              • 3,250 Posts
                • 23853
                • 8 Posts
                thanks Mark

                just to see whether i got it right: the grouping will be available with the new version of ditto. and I have to create a ’TV’ (volume, for ex) and every subcategory (volume1, volume2 ...)will be a different value of this new TV. So, for each article I will assign a value, namely its parents name. is this correct? sorry, if i ask the obvious, but I’m a newbie to modx ; ))

                  • 18397
                  • 3,250 Posts
                  This feature may be included in the next major version of Ditto (3.x not 2.x) and as such its implementation is TBD.

                  Upon rereading your post, it seams like you basically want to create a menu-like structure where the actual articles have additional text displayed. Wayfinder, MODx’s default menu snippet, should be able to handle that.
                    • 23853
                    • 8 Posts
                    Hi Mark!

                    great, I’m looking forward to it.
                    Yes, at this moment, I already implemented it as a menu, however, it is not suitable for the future when there will be lots of volumes and articles, and the page will turn out to be a huge list of all. I rather would like an archive, where users can browse pages of articles grouped by their volume . (it’s not possible as far as i know to paginate a menu)

                    thanks again for your help
                      • 10449
                      • 956 Posts
                      Well, there’s always the option to write your own custom snippet and DB-queries, if you’re brave enough wink