We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33337
    • 3,975 Posts
    DocCount Snippet by Mark Kaplan allows you to display number of documents in a specified folder.

    Sample implementation:

    Category name ([[DocCount? &startID=`2`]])

    will display:

    Category name (6)

    Snippet Code:
    <?php // <- Strip me out after placing in Snippet Editor
    
    
    #::::::::::::::::::::::::::::::::::::::::
    # Snippet name: DocCount
    # Short Desc: Displays # of documents in a specified folder 
    # Created By Mark Kaplan ([email protected])
    #
    # Date: April 3, 2006
    #
    # Usage: [[DocCount? &startID=`1`]]
    #::::::::::::::::::::::::::::::::::::::::
    
    $resourceparent = isset($startID) ? $startID : $modx->documentIdentifier; 
    $resource = $modx->getActiveChildren($resourceparent, 'id', 'ASC', $fields='*');
    $num = count($resource);
    return $num;
    
      Zaigham R - MODX Professional | Skype | Email | Twitter

      Digging the interwebs for #MODX gems and bringing it to you. modx.link
      • 6726
      • 7,075 Posts
      Thanks for sharing... handy for blogs, yeah smiley
        .: COO - Commerce Guys - Community Driven Innovation :.


        MODx est l&#39;outil id
        • 33337
        • 3,975 Posts
        You can see live example on http://zidesigns.com, scroll down and watch for "Categories" wink.

        regards,

        zi
          Zaigham R - MODX Professional | Skype | Email | Twitter

          Digging the interwebs for #MODX gems and bringing it to you. modx.link