We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16899
    • 284 Posts
    Hi All

    I´m trying to do something really simple with Archivist... but with no sucess!! sad

    With the
    [[!ArchivistGrouper?]]
    i just want an output grouping Month´s by Year, so all i want is :

    
    <ul>
    <li>2012
        <ul>
              <li>January</li>
              <li>February</li>
              <li>March</li>
              <li>... and so on ...</li>
        </ul>
    </li>
    <li>2011
        <ul>
              <li>January</li>
              <li>February</li>
              <li>March</li>
              <li>... and so on ...</li>
        </ul>
    </li>
    </ul>
    


    How can i do this?

    Many thanks in advance!! smiley
    [ed. note: legues last edited this post 14 years, 1 month ago.]
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You might be able to use an ArchivistGrouper snippet set to &mode=`year`, then in its tpl use another ArchivistGrouper snippet with its mode set to `month`.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 16899
        • 284 Posts
        Something like this?

        [[!ArchivistGrouper? &mode=`year` &itemTpl=`itemTpl`]]



        itemTpl:
        [[!ArchivistGrouper? &mode=`month` ]]
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          You'd probably need to have the year placeholder somewhere in that year mode tpl.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 16899
            • 284 Posts
            I have no idea how to solve this... sad
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Try this for the year template (taken from the default yearcontainer.chunk.tpl):
                  <li><a href="[[+url]]">[[+year]]</a>
                        [[!ArchivistGrouper? &mode=`month` ]]
                  </li>
              


              As it is, this will not quite do what you want. I'm not quite sure how to get each year's inner snippet call to only display the items for that year. Perhaps an output modifier in the row tpl would do the job.

              I'd like to see exactly what the above setup produces, using the default monthcontainer tpl and row/item tpl.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 16899
                • 284 Posts
                Please check the attached file... it duplicates my news items!!!! sad

                Don´t you think this plugin should be retouched? smiley It´s a great plugins.... but i think it shoulb be optimized in terms of templating!!! Don´t you agree with me? smiley
                  • 16899
                  • 284 Posts
                  I found this article about something similar - https://forums.modx.com/?action=thread&thread=72292 - they speak about New parameter &groupByYear and &yearGroupTpl ...but nothing about these parameters on the plugin documentation!!!!!!!
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    Hm. I expected as much. Close, but not quite what's needed.

                    It's pretty much impossible for any add-on to be able to anticipate every possible desired result.

                    Please try it again, this time with this yeargroup tpl also.
                    <ul>
                        <li>
                        <ul>
                            [[+row]]
                        </ul>
                        </li>
                    </ul>


                    What we want to do is to get the outer year, then a list of inner months.

                    That list of inner months can be filtered with an output filter to only display the ones whose date contains the same year as the outer year item. Or at least I'm pretty sure this would work. It's just a matter of getting the levels of tpls sorted out.


                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org
                      • 16899
                      • 284 Posts
                      This is the solution!!!! smiley

                      <ul>
                      [[!Archivist? &parents=`7` &target=`27` &useFurls=`0` &setLocale=`en` &groupByYear=`1`]]
                      </ul>