We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10405
    • 288 Posts
    Hi, I’m having some issues getting nested categories for a blog system to work with Ditto and was wondering if anyone else has had the same problem and knows of a fix.

    In the root of my site I have a resource called Blog, which has a page ID of 10. This page shows the most recent blog in the main content area (or will once set up), and in the right hand column next to this there are three sections. (a) Categories, of which there are five. Blogs will fall into one of these five categories. (b)Recent Posts. The intention is to have links to the five most recent blogs from ALL categories here, i.e 5 most recent regardless of category. (c) Archives. The intention for this section is to have links to previous months, i.e any blogs / posts that were published in say June, or May. A link to June would show all the blogs published in June, and so on.

    So, I set up the Categories to begin with, as five child resources within the Blog container. On the main blog page template I made a Ditto call as follows:

    [!Ditto? &parents=`10` &showPublishedOnly=`1` &start=`1` &tpl=`ditto.archivesummary`!]

    And this works fine- it showed each child resource (IDs 12, 13, 14, 15 and 16) as a list according to the Ditto template I used. The problem came when I made a new resource inside one of these. For example, inside resource 12, I created a new resource for an actual blog within this category. In the template for resource 12, I made the following Ditto call:

    [!Ditto? &parents=`12` &showPublishedOnly=`1` &start=`1` &tpl=`ditto.archivesummary`!]

    So in theory this should show the children for resource 12 in the column listing. Unfortunately it shows nothing.

    Each resource from 12 to 16 has also been configured as a container.

    Any ideas?
      • 12379
      • 460 Posts
      Do you really need the &start parameter?
        Mostly harmless.
        • 36592
        • 970 Posts
        If you are trying to place 2 or more Ditto calls on one page, I suppose you should use &id parameter to distinguish those.
          • 12379
          • 460 Posts
          http://ditto.modxcms.com/files/snippet-ditto-php.html

          start Number of documents to skip in the results
            Mostly harmless.
            • 10405
            • 288 Posts
            No, the thing is I’m not trying to skip documents, it’s simply that the container resource inside the main container (i.e which holds blogs of a certain category) just isn’t showing any of the child resources when I try calling them using this:

            [!Ditto? &parents=`12` &showPublishedOnly=`1` &start=`1` &tpl=`ditto.archivesummary`!]

            - in the template for that resource / container.

            And yet all the children inside the main container (one level up i.e at the root) show fine.

            ??
              • 12379
              • 460 Posts
              Exactly - try removing &start parameter...
                Mostly harmless.
                • 10405
                • 288 Posts
                Hmm, that seems to work- thanks. Any idea why &start messes it up?

                It was in the samples I originally used.
                  • 12379
                  • 460 Posts
                  If you only had one test document in that folder, then &start was telling Ditto to skip that doc.
                    Mostly harmless.