Blog Sections Open
Grouping getResources Output by Publication Date
Flat news lists are easy to generate with getResources or pdoResources , but editors often want a layout grouped by month or year. The original question described a list where ten posts should be displayed in three date
Flat news lists are easy to generate with getResources or pdoResources, but editors often want a layout grouped by month or year. The original question described a list where ten posts should be displayed in three date groups rather than one continuous stream.
The Goal
Post 1
Post 2
Post 3
=== October 2013 ===
Post 4
Post 5
Post 6
=== September 2013 ===
Best Approach
Do not try to force this entirely inside one tiny chunk. Instead, pass the publication date into a wrapper or preparation step and insert a heading whenever the year-month value changes.
Typical Strategy
- sort resources by
publishedondescending - track the previous item date in a placeholder or helper variable
- render a heading when the month-year combination changes
- keep the resource row markup separate from the grouping logic
Why This Matters
Once the grouping logic is isolated, you can reuse the same feed for archives, news pages, and timeline blocks without rewriting the row template. Whether you use getResources, pdoResources, or an Evolution-native equivalent, the principle is the same: list generation and date grouping should not be mixed into unreadable template code.
Combining Multiple TV Filters in Ditto
How to think about OR-style TV filters in Ditto when one parameter is not enough and output should match several TV values.
Troubleshooting File Uploads in UpdateProfile
A practical checklist for cases where UpdateProfile ignores uploaded files or receives empty POST and FILES arrays in MODX Revolution projects.