Forum

Thread tagged as: Question

Producing List of Most Recent Pages Created

We love the Navigation Group feature which allows us to auto produce pages that meet a particular criterion.

Unfortunately Perch does not provide us with a Creation/Modification date as part of Navigation Groups that would allow us to auto list the most recent (say 10) pages created or modified. Such a listing would be very helpful in drawing attention of returning visitors to recently added/changed material.

Has anyone found a solution to this? We have a JavaScript snippet at the foot of each page saying when it was last modified but I don't know how to use this - or anything else - to get what I would like.

Any suggestions most welcomed.

Stefan Youngs

Stefan Youngs 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You can use perch_page_modified() to get the modified date.

Does this operate on every page created or only on those modified after creation? I want to pick up pages that have been created but not subsequently modified as well as those that have been modified

How do I use this to present a page listing pages by modified date, ideally truncating this to the last 10 pages created/modified? I'm trying to develop something useful to readers, who often ask 'What's new?'

Do I use a modification of the following code I use to generate out listing pages (say all pages related to 1945 where Navgroup = 1945)

<?php perch_pages_navigation(array( 'navgroup' => perch_content('Navigation group', true), 'levels' => 0 )); ?>

Thanks

Drew McLellan

Drew McLellan 2638 points
Perch Support

You can't produce a listing from it - it just outputs the date the page was modified.

Thanks.

So I guess I could include perch_page_modified() in each page and then build an external php program to search for that and produce a listing for me?

Drew McLellan

Drew McLellan 2638 points
Perch Support

I would not do it that way, no. If you're going to write something custom, just query the pages table and sort by pageModified.

Thanks. That's very helpful. Always appreciative of your giving me a little bit more help than the programmers need.