We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 51347
    • 82 Posts
    Hello,

    i try to get the first level of my tree in pdo with depth: TV, Animals, Homepages, Examples

    but i get all resources of my site: TV, Movies, Shows, Animals, Dogs, Cats, Homepages, Design...


    It is a problem with parents "0"?


    My example:

    [[pdoResources? &parents=`0` &depth=`1` &tpl=`@INLINE <p>[[+pagetitle]]</p>`]]


    Resources Tree:
    
    
    - Homepage (1)
    
    - TV (2) 
      - Movies (3)
      - Shows (4)
    
    - Animals (5)
      - Dogs (6)
      - Cats (7)
    
    - Homepages (8)
      - Design (9)
      - Art (10)
    
    - Examples (11)
      - How to.. (12)
      - Build HP (13)
    

    This question has been answered by Jako. See the first response.

      • 4172
      • 5,888 Posts
      I think, you need:

      &depth=`0`


      no depth == only one level
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 51347
        • 82 Posts
        I tryed this allready and get the same result. PDO show me all resources of the tree.

        [[pdoResources? &parents=`0` &depth=`0` &tpl=`@INLINE <p>[[+pagetitle]]</p>`]]
          • 22840
          • 1,572 Posts
          If all your wanting to output is the pagetitle try the following:

          [[pdoMenu? &parents=`0` &level=`1` &tpl=`@INLINE <p>[[+pagetitle]]</p>`]]
            • 4172
            • 5,888 Posts
            but &depth should really work.

            try to run the call with

            &showLog=`1`
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
            • discuss.answer
              • 13428 ☆ A M B ☆
              • 1,031 Posts
              Maybe it is the stupid pdoTools trap and you have to use

              &parents=`+0`


              Since parents = 0 means all resources in a query.
                • 51347
                • 82 Posts
                Thanks for all your answers guys!

                Jakos solution works!

                [[pdoResources? &parents=`+0` &depth=`0` limit=`50` &tpl=`@INLINE <p>[[+pagetitle]]</p>`]]


                @Paulp
                I have the same result as before.

                @Bruno
                The new log:
                0.0002520: pdoTools loaded
                0.0000491: xPDO query object created
                0.0008559: Added selection of modResource: SQL_CALC_FOUND_ROWS `id`, `type`, `contentType`, `pagetitle`, `longtitle`, `description`, `alias`, `link_attributes`, `published`, `pub_date`, `unpub_date`, `parent`, `isfolder`, `introtext`, `richtext`, `template`, `menuindex`, `searchable`, `cacheable`, `createdby`, `createdon`, `editedby`, `editedon`, `deleted`, `deletedon`, `deletedby`, `publishedon`, `publishedby`, `menutitle`, `donthit`, `privateweb`, `privatemgr`, `content_dispo`, `hidemenu`, `class_key`, `context_key`, `content_type`, `uri`, `uri_override`, `hide_children_in_tree`, `show_in_tree`, `properties`
                0.0000510: Processed additional conditions
                0.0004880: Added where condition: modResource.parent:IN(0), modResource.published=1, modResource.deleted=0
                0.0001750: Sorted by modResource.publishedon, DESC
                0.0000081: Limited to 50, offset 0
                0.0005670: SQL prepared "SELECT SQL_CALC_FOUND_ROWS `modResource`.`id`, `modResource`.`type`, `modResource`.`contentType`, `modResource`.`pagetitle`, `modResource`.`longtitle`, `modResource`.`description`, `modResource`.`alias`, `modResource`.`link_attributes`, `modResource`.`published`, `modResource`.`pub_date`, `modResource`.`unpub_date`, `modResource`.`parent`, `modResource`.`isfolder`, `modResource`.`introtext`, `modResource`.`richtext`, `modResource`.`template`, `modResource`.`menuindex`, `modResource`.`searchable`, `modResource`.`cacheable`, `modResource`.`createdby`, `modResource`.`createdon`, `modResource`.`editedby`, `modResource`.`editedon`, `modResource`.`deleted`, `modResource`.`deletedon`, `modResource`.`deletedby`, `modResource`.`publishedon`, `modResource`.`publishedby`, `modResource`.`menutitle`, `modResource`.`donthit`, `modResource`.`privateweb`, `modResource`.`privatemgr`, `modResource`.`content_dispo`, `modResource`.`hidemenu`, `modResource`.`class_key`, `modResource`.`context_key`, `modResource`.`content_type`, `modResource`.`uri`, `modResource`.`uri_override`, `modResource`.`hide_children_in_tree`, `modResource`.`show_in_tree`, `modResource`.`properties` FROM `modx_site_content` AS `modResource` WHERE  ( `modResource`.`parent` IN (0) AND `modResource`.`published` = 1 AND `modResource`.`deleted` = 0 )  ORDER BY modResource.publishedon DESC LIMIT 50 "
                0.0015571: SQL executed
                0.0002019: Total rows: 30
                0.0007169: Rows fetched
                0.0034289: Loaded "modChunk" with name "footerstadt"
                0.0933220: Returning processed chunks
                0.1001909: Total time
                11 796 480: Memory usage
                [ed. note: joe-petts last edited this post 10 years, 3 months ago.]