We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25236
    • 6 Posts
    Hello all...

    is there an easy way to output the last site change date when for example a page is editted?

    Like: "Last change was at: 19-02-2007 00:18"

    Maybe there is already a snippet for it but I can’t find it undecided

    Tnx.
    Robbie
      • 1511
      • 144 Posts
      Use the "editedon" property of the document to get the unix timestamp, then use the PHx plugin and placeholder [+editedon:date="format"+] to format the output.

        • 25236
        • 6 Posts
        andrazk: tnx for your reply but as you suggest i guess this is for the document itself currently outputted.

        I think I was not clear sorry but what I want is a last change date in general, saying "the site
        was last updated at: 19-02-2007 00:18" where the date and time is the date and time of the last
        changed document. This will be shown in a footer on every page.
          • 1511
          • 144 Posts
          Huh, sorry, I’ve missed the site-wide condition.
          You could write a snippet like this:
          $res = $modx->db->select('*', $modx->getFullTableName('site_content'), ' published=1', ' editedon DESC LIMIT 1');
          $row = $modx->db->getRow($res);
          return strftime('%d-%m-%y %H:%M', $row[editedon]);
          
          and it would return the formatted date of the last edited published page.
            • 25236
            • 6 Posts
            yeeeeaaaahhhhhh exactly what i wanted THANK YOU very much andrazk