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

    I need a bit of help with setting up an article archive via ditto/reflect. I’ve done research on the docs site and in this forum, but am not quite grasping how to do the following:

    • Have my current articles page, from which the ditto call is made, show articles for a given time period. In my case, I’d prefer to show the last 12 months
    • Use reflect to aggregate the remaining articles by year only. I’d like reflect to output a list of archive years where clicking on a particular year would lead you to a full list of all articles for that year (there are not enough articles in the collection to justify arranging by month and year)
    • Format dates via PHX—my date source is a custom date tv and not one of the core modx dates (createdon, etc.). I’ve got everything humming nicely on the non-archive side of the equation using [+articleDate:date=`%m/%d/%Y`+] to display dates in my ditto template and individual article pages. It appears, however, that I cannot do the same in the reflect templates (i.e., [+year:date=`%m/%d/%Y`+] does not work)

    Note that the document framework already in place is:

    • a main container document "Article Library"
    • sub container documents for each year ("2001," "2002," and so on)
    • individual articles (housed under their corresponding year container)

    My current snippet calls are, in my main content area:
    [[Ditto?parents=`101` 
       &id=`articles` &depth=`3` &extenders=`dateFilter` 
       &sortBy=`articleDate` &dateSource=`articleDate` &tpl=`articleTbl`  
       &paginate=`1` &paginateAlwaysShowLinks=`1` &hideFolders=`1` &display=`12`]]

    and in a side column:
    [[Reflect? 
       &id=`articles` &dateSource=`articleDate` 
       &dittoSnippetParameters=`parents:101` &getDocuments=`1`]]

    (Note: Line breaks in code above made here only for readability purposes)

    Thanks for any guidance you can give ...

    Cheers, Jim
      ------
      Server: *nix, ModX Evo 1.0.4, Apache 2.x, PHP 5.x, Mysql 5.x.