We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 52833
    • 1 Posts
    wonderwilson Reply #1, 10 years ago
    Hi folks, I'm new to modx and the forums - so please forgive me if this has already been answered. I'm looking to create an Article count similar to the attached. Could somebody point me in the right direction on how to achieve this?

    I found another site that uses this: [[!getArticleCount?&parents=`[[+id]]]`]] - could this be the answer?

    Thanks in advance.

    Darren
      • 3749
      • 24,544 Posts
      I'm not aware of an extra that does that, but if you use this tag on your Articles container page and create a snippet called getArcticleCount with the code below, it should do it:

      [[!getArticleCount]]



      /* getArticleCount snippet */
      $docId = $modx->resource->get('id');
      return $modx->getCount('modResource', array('parent' => $docId));
      

        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting