I just modified this snippet with JohnO’s ’last child’ hack. Works a treat. Now when selecting News from the main menu it goes to a page with the latest news item and a sub-menu of all previous articles down the side. Excellent
UPDATE:
Since I posted this I have modified the code a little as follows:
Find the line: $children= $modx->getActiveChildren($docid, ’menuindex’, ’ASC’);
And I changed it to: $children= $modx->getActiveChildren($docid, ’createdon’, ’DESC’);
Reasoning: I checked out the table modx_site_content in PHPMyAdmin to find the table’s field names. I wanted to sort by the date the document was created, not the menu index; (In my site, because I’ve added historical articles in no particular order, the document ID’s don’t necessarily run in date order). I guess I could have chosen ’pub_date’ as well for the same result.
So, in summary, pick the DB field you want to sort by and replace ’menuindex’ with it. Choose ASC or DESC depending on which direction you want to sort.