We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18373 ☆ A M B ☆
    • 3,141 Posts
    Hello,

    I’m working on some sort of download repository. For this, I’ve created the following structure.

    Mainpage (id 2)
    - Category 1 (id 3)
    -- Files go here
    - Category 2 (id 4)
    -- File 1 (id 7)
    -- File 2 (id cool
    - Category 3 (id 5)
    -- Files go here
    - Category 4 (id 6)
    -- Files go here

    The Mainpage shows a category overview using ditto:
    [!Ditto? &startID=`2` &depth=`1` &tpl=`dc-overzicht-categorien`!]

    the ’dc-overzicht-categorien’ chunk is as follows:
    <a class="dc-overzicht-categorien-titel" href="[~[+id+]~]"><h3>[+pagetitle+]</h3></a>
    <p class="dc-overzicht-categorien-beschrijving" style="font-style: italic;">[+introtext+]</p>


    I’d like to add the number of documents (= files) to that category overview.

    Any suggestions on how to do that?
      Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

      Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
      • 7231
      • 4,205 Posts
      Not sure about Ditto...but Wayfinder has this function:
      &showSubDocCount
      default: FALSE
      values: [ TRUE | FALSE ]
      description: The showSubDocCount parameter, if set to TRUE, will insert the number of documents in each folder into the placeholder [+wf.subitemcount+]
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don&#39;t know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 18373 ☆ A M B ☆
        • 3,141 Posts
        Yea, I knew Wayfinder had it.

        There’s a short description about the categories in the introtext which I also want to show and I don’t think wayfinder allows you to show that.


        Actually, I went to check that out and noticed it does support introtext as a field. So, I could just as easily use wayfinder shocked



        Thanks! That was the help I needed.

        I now use this call:
        [!Wayfinder? &startID=`2` &level=`2` &rowTpl=`dc-overzicht-categorien` &textOfLinks=`introtext` &showSubDocCount=`1`!]

        with the chunk modified to
        <a class="dc-overzicht-categorien-titel" href="[~[+wf.docid+]~]"><h3>[+wf.title+]</h3></a>
        <p class="dc-overzicht-categorien-beschrijving" style="font-style: italic;">[+wf.linktext+] (Totaal [+wf.subitemcount+] bestanden in deze categorie.)</p>


        (Note the &level=`2` in the call - when I left it at 1 it wouldn’t see any docs in that folder (it wasn;t looking beyond the parent) so hence that needs to be 2 (or more depending on your structure).)

        Thanks Dev!
          Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

          Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.