GetSimple Support Forum
Sort subpages by date in Page Management - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Scripts & Components (http://get-simple.info/forums/forumdisplay.php?fid=11)
+--- Thread: Sort subpages by date in Page Management (/showthread.php?tid=1811)



Sort subpages by date in Page Management - Carlos - 2011-06-04

Another small trick (for GS 3.0).

In Page Management ("View all pages"), list subpages (children) of a parent sorted by date instead of page title.

Edit /admin/pages.php line 42. Change this:

Code:
$pagesArray[$count]['sort'] = $parentTitle .' '. $data->title;

to:
Code:
$pagesArray[$count]['sort'] = $parentTitle .' '.str_pad(strval(2147483647-strtotime($data->pubDate)),10,'0',STR_PAD_LEFT);

That's for descending (newer first). If you prefer ascending order, change to:
Code:
$pagesArray[$count]['sort'] = $parentTitle .' '.str_pad(strval(strtotime($data->pubDate)),10,'0',STR_PAD_LEFT);

(Note: Parent pages will still be sorted by title.)


Sort subpages by date in Page Management - Carlos - 2011-06-08

There was a bug in these patches (pages older than Aug 2001 were not sorted properly).

I've edited the post to fix both.