MODX Community

Display list of recently modified resources

I’m trying to create a quick list of URLs so that i can see what has been recently changed. But I’m not getting the right output. Here’s what I have:

[[$latestPages? &number=5]]

[[pdoResources?
&parents=0
&depth=0
&resources=``
&sortby={"editedon":"DESC"}
&tplWrapper=@INLINE <h1>[[+totalListCount]] Results</h1><ul style="list-style: none;">[[+output]]</ul>
&tpl =@INLINE <li>[[++site_url]][[+uri]]</li>
&limit=[[+number]]
&setTotal=1
&totalVar=totalListCount
]]

It’s probably something simple I’m missing. But I’m receiving output but not in any logical order…

Thanks for the help!

I don’t see anything wrong, but you might try this:

&sortby= `editedon`
&sortdir=`DESC`

Actually, you should be able to leave out the second one because it’s the default.

thanks but that didn’t make a difference. The results were still in the wrong order. So I amended the &tpl parameter to include the editedon date at the end:

&tpl =@INLINE <li><a href="[[++site_url]][[+uri]]">[[++site_url]][[+uri]]</a> - [[+editedon:strtotime:date=%d %B %Y]]</li>

All that resulted was the hyphen followed by empty space. So editedon just isn’t working for some reason. Any ideas?

thx

editedon isn’t the problem here. This line should work:

&tpl =`@INLINE <li><a href="[[++site_url]][[+uri]]">[[++site_url]][[+uri]]</a> - [[+editedon]]</li>`

If you want a nicely formatted date, you can’t use @INLINE. Move the code to a new chunk and delete the strtotime output modifier. (pdoResources and publishedon Date Formatting)

The new chunk should look like this:

<li><a href="[[++site_url]][[+uri]]">[[++site_url]][[+uri]]</a> - [[+editedon:date=`%d %B %Y`]]</li>

this should work, too:

&tpl=`@INLINE <li><a href="[[++site_url]]{{+uri}}">[[++site_url]]{{+uri}}</a> - {{+editedon:date=`%d %B %Y`}}</li>`
1 Like