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

    Is there a snippets that displays the last time the site was updated?

    Thx

    klikklik
      • 4041
      • 788 Posts
      This snippet shows two things:
      1. if a document has not been edited it shows the created date

      2. if the document has been edited it shows the edited date

      you can go through and modify the $update_pre, $update_suf, and the $update_text, pretty simple setup...

      /*
        last_updated
        last edit:  7/26/06  3:52 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 =="0"){
          $update_date = strftime($format,$doc_created);
          $update_text = "created on ";
         }else{
          $update_date = strftime($format,$doc_edited);
          $update_text = "modified on ";
         }
      
      $output = "$update_pre $update_text $update_date $update_suf";
      return $output;
        xforum
        http://frsbuilders.net (under construction) forum for evolution
        • 16042
        • 14 Posts
        HI,

        Thanks, gonne try it rigth now.

        klikklik
          • 4041
          • 788 Posts
          cool... note that it shows the update status on a per page basis, so I put mine in the bottom of my template, or it can be added to individual pages.

          the $update_pre and $update_suf can be modified to use a div, span, or however you want to style the output...
            xforum
            http://frsbuilders.net (under construction) forum for evolution
            • 6726
            • 7,075 Posts
            Nice one, something which was definitely missing... thanks !
              .: COO - Commerce Guys - Community Driven Innovation :.


              MODx est l&#39;outil id