We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29076
    • 615 Posts
    I have this category-setup:

    Level-1 (Doc-ID=2)
    Level-1-1
    Level-1-1-1
    Level-1-1-2
    Level-1-2
    Level-1-2-1
    Level-1-2-2
    Level-1-2-3
    Level-2-1
    Level-2-1-1
    Level-2-1-2
    Level-2-2
    Level-2-2-1
    Level-2-2-2
    Level-2-2-3

    And so on. How can I make a list with only all the Level-x-x or only all the Level-x-x-x?

    I tried [[Ditto?parents=`2` &depth=`2` &tpl=`Familiy-list-tpl` &display=`all` &sortBy=`pagetitle` &sortDir=`ASC` &filter=`hidemenu,0`]], but it shows both Level-x-x and Level-x-x-x.

    I use:
    MODx 0.96
    Ditto 2.02

    Thanks.
      I think, thererfor I am! But what I am, and why...?
      • 18397
      • 3,250 Posts
      Assuming Level-x-x-x is not a container, changing &filter=`hidemenu,0` to &filter=`hidemenu,0|isfolder,1` should only show Level-x-x documents.
        • 29076
        • 615 Posts
        Thanks for the answer, but the Level-x-x-x is a container. I’m sorry I didn’t tell the hole story, the structure is actually like this:

        Level-1 (Doc-ID=2)
        Level-1-1
        Level-1-1-1
        Level-1-1-2
        Level-1-1-2-1
        Level-1-1-2-2
        Level-1-2
        Level-1-2-1
        Level-1-2-2
        Level-1-2-2-1
        Level-1-2-2-2
        Level-1-2-3
        Level-1-2-3-1
        Level-1-2-3-2
        Level-2-1
        Level-2-1-1
        Level-2-1-2
        Level-2-1-2-1
        Level-2-1-2-2
        Level-2-2
        Level-2-2-1
        Level-2-2-2
        Level-2-2-3

        And the question is still: How can I make a list with only all the Level-x-x or only all the Level-x-x-x?
          I think, thererfor I am! But what I am, and why...?
          • 18397
          • 3,250 Posts
          Are there any attributes that all the Level-x-x items share in common that the other level items do not?
            • 29076
            • 615 Posts
            Yes, all the pagetitles ends with xxxxaceae (Latin familynames of plants), like Betulaceae, Rosaceae, Salicaceae, Ericaceae and so on.
              I think, thererfor I am! But what I am, and why...?
              • 18397
              • 3,250 Posts
              Give this custom filter a try:
              <?php
              
              // filename: suffixFilter.extender.inc.php
              // location: assets/snippets/ditto/extenders
              // add &extenders=`suffixFilter` to your Ditto call to enable
              
              $filters["custom"]["suffixFilter"] = array("pagetitle","suffixFilter"); 
              if (!function_exists("suffixFilter")) {
              	// ---------------------------------------------------
              	// Function: suffixFilter
              	// ---------------------------------------------------
              	function suffixFilter($resource) {
              		if (substr($resource['pagetitle'], -5) == "aceae") {
              			return 1;
              		} else {
              			return 0;
              		}
              	}
              }
              ?>
              
              
                • 29076
                • 615 Posts
                Thank you very much for the answer. I followed your description in the code you gave me, but unfortunatelly it didn’t work. It still gives me a list with both Pteriophyta and Equisetaceae, that is both level 3 and 4, and it should only be from level 4 (where Toplevel=level 1).

                This is the call used:
                [!Ditto?parents=`2` &depth=`2` &tpl=`Familiy-list-tpl` &display=`all` &sortBy=`pagetitle` &sortDir=`ASC` &filter=`hidemenu,0` &extenders=`suffixFilter` !]

                I guess thats because I didn’t explain my self good enough. Next time I will start with an accurate description of the situation. Sorry about that.

                Here is the list:

                Toplevel ID=0
                        Plants ID=2
                                 Pteridophyta
                                          Equisetaceae
                                                    Equisetum
                                          Lycopodiaceae
                                                    Huperzia
                                          --"--
                                          --"--
                                 Magnoliophyta
                                          Salicaceae
                                                    Salix
                                          Betulaceae
                                                    Betula
                                          Polygonaceae
                                                    Bistorta
                                                    Koenigia
                                                    Oxyria
                                          --"--
                                          --"--
                                 Liliopsida
                                          Tofieldaceae
                                                    Tofieldia
                                          Juncaceae
                                                    Juncus
                                                    Luzula
                                          Cyperaceae
                                          --"--
                                          --"--
                          Lists
                                  Document with the list containing the xxxxaceae-names

                What I try to make is a list with the xxxxaceae, the blue ones in the description.
                  I think, thererfor I am! But what I am, and why...?
                  • 18397
                  • 3,250 Posts
                  Can you attach the debug output of the call? (Append &debug=`1` and then choose "Save Debug Console")