List Indexer works fine to show multiple document edits, but this snippet here will show either the created on or edited on date for a specific document -
/*
last_updated
last edit: 2/07/06 9:30 pm est
Usage: [!last_updated?dateFormat=%B %e, %Y!] Returns date formatted: July 13, 2005
See strftime() documentation for additional formatting options
*/
// Default Date/Time format to use if not sent in snippet call
$format = isset($dateFormat) ? $dateFormat : "%B %e, %Y";
// added a message to show
$update_pre ="<span class='smtxtblue'>This document was ";
$update_suf ="</span>";
//$page_id =$modx->documentObject['id'];
$doc_created = $modx->documentObject['createdon'];
$doc_edited = $modx->documentObject['editedon'];
if($doc_edited ==""){
$update_date = strftime($format,$doc_created);
$update_text = "created on ";
}else{
$update_date = strftime($format,$doc_edited);
$update_text = "modified on ";
}
$update = "$update_pre $update_text $update_date $update_suf";
return $update;
just add this into either the document or the template and it will print whatever text you want to show, as it is now the outout is:
This document was modified on July 26, 2006
to change the output format, modify the following areas:
$update_pre
$update_suf
$update_text - "modified on "; / "created on";