Show a list of the recently updated pages

  Previous article Next article  

Outputs a list of recently updated pages.
This code is forked from the CMS Made Simple {recently_updated} plugin which is originally made by Elijah Lofgren. At the existing CMSMS plugin it isn't possible to change the lay-out of the output. I needed it for my website though, so I created this UDT which gave me more flexibility.

User Defined Tag, named "recent_page_updates"
$number = isset($params['number']) ? $params['number'] : '10';
$dateformat = isset($params['dateformat']) ? $params['dateformat'] : 'd.m.y h:m';  

$gCms = CmsApp::get_instance();
$hm = $gCms->GetHierarchyManager();
$db = $gCms->GetDb();

$output = '<ul>';

// Get list of most recently updated pages excluding the home page
$q = "SELECT * FROM ".CMS_DB_PREFIX."content WHERE (type='content' OR type='link')
AND default_content != 1 AND active = 1 AND show_in_menu = 1
ORDER BY modified_date DESC LIMIT "
$dbresult = $db->Execute( $q );
if( !$dbresult ) {
  echo 'DB error: '. $db->ErrorMsg()."<br/>";
while ($dbresult && $updated_page = $dbresult->FetchRow())
  $curnode = $hm->getNodeById($updated_page['content_id']);
  $curcontent = $curnode->GetContent();
  $output .= '<li>';
  $output .= '<a href="'.$curcontent->GetURL().'">'.$updated_page['content_name'].'</a>';
  $output .= ' ( '.date($dateformat,strtotime($updated_page['modified_date'])).' )';
  $output .= '</li>';

$output .= '</ul>';

return $output;

  How to use

{recent_page_updates number=5 dateformat='d.m.y'}
  • dateformat - Use the format you whish (php-date-format). Default setting is d.m.y h:m.
  • number - Number of updated pages to show. Default is 10.

By changing the "$output" lines in the UDT, you can change the lay-out of the output.

  Working example

Buy Me A Coffee

  Show related articles:

  Comment Form


Click here to open the form


  1 Comment

Buy Me A Coffee

CMS Made Simple - Tutorials, Tips and Tricks - CMSMS

Show a list of the recently updated pages

  Article optimized for CMSMS 2.x

  Last tested in: CMSMS 2.1.1
  Last updated: 10-06-2019
  Comments: 1

Buy Me A Coffee


Ads help me to help you! Thanks!

Ads help me to help you! Buy products from these advertisers!