Installation: put the following code in cmsimple/userfuncs.php:
Code: Select all
<?php
/**
* @copyright 2016 Christoph M. Becker
* @license GPLv3
*/
function recently_changed($count = 5)
{
global $pd_router;
$pageData = $pd_router->find_all();
uasort($pageData, function ($a, $b) {
return $b['last_edit'] - $a['last_edit'];
});
$pages = array();
$i = 0;
foreach (array_keys($pageData) as $page) {
if ($i < $count) {
if (!hide($page)) {
$pages[] = $page;
}
$i++;
} else {
break;
}
}
global $sn, $h, $u;
$html = '<ul class="recently_changed">';
foreach ($pages as $page) {
$html .= '<li><a href="' . "$sn?$u[$page]" . '">' . $h[$page] . '</a></li>';
}
$html .= '</ul>';
return $html;
}
- to show the list on all pages insert the following in an appropriate place in template.htm:
Code: Select all
<?php echo recently_changed()?>
- to show the list on a single page only, insert the following on that page:
Code: Select all
{{{PLUGIN:recently_changed();}}}
Code: Select all
recently_changed(10)
Maybe somebody wants to tell Edi about this; the code is supposed to run on CMSimple 4 as well.