Hi,
with my old modx installation 0.9.6.3 I had an extra called lastUpdate, which gave me a date stamp of the last changed element of my site, regardless from where in the doc tree I called it.
As lastUpdate is not available in modx 3, I tried to get this working via getResources and getDate, but I can’t get it working.
Maybe it’s possible with this snippets, maybe there is another way to achive this - any help would be greatly appreciated.
I post the code of lastUpdate here, maybe it’s easy to adopt?
Kind regards
Andre
// snippet: [[lastUpdate]]
// simply displays the last edited document
// use for site-wide update info like "This website was last updated: ..."
// change echo() to return() if needed
// modify date-format to suit your language/region, see http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-format
// http://modxcms.com/forums/index.php/topic,16751.0.html
// tested with MODx v. 0.9.6
// $dbQuery = "SELECT id, pagetitle, FROM_UNIXTIME(editedon, '%d.%m.%Y [%H%:%i:%s]') AS humanDate FROM modx_site_content ORDER BY editedon DESC LIMIT 0,1";
$dbQuery = "SELECT id, pagetitle, FROM_UNIXTIME(editedon, '%d.%m.%Y') AS humanDate FROM modx_site_content ORDER BY editedon DESC LIMIT 0,1";
$result = mysql_query($dbQuery) or die( mysql_error() );
if(mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_array($result)) {
extract($row);
$url = $modx->makeUrl($id, '', '', 'full');
// echo "Last update: <a href=\"$url\">$pagetitle</a> - $humanDate";
echo "$humanDate";
}
}