<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-15">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    I'm seeking for a means to insert the date/time a page was published
    last time so that one can read e.g. at the bottom of a<br>
    page something like "last edit Aug, 7th, 2014". <br>
    <br>
    I found some suggestion in a <a
href="http://stackoverflow.com/questions/14338306/how-to-get-last-published-date-from-a-cmsresource-in-opencms">stackoverflow
      thread </a>:<br>
    <br>
    <pre style="" class="lang-java prettyprint prettyprinted"><code><span class="kwd">public</span><span class="pln"> </span><span class="kwd">static</span><span class="pln"> </span><span class="typ">Date</span><span class="pln"> getLastPublishedDate</span><span class="pun">(</span><span class="typ">CmsJspActionElement</span><span class="pln"> cms</span><span class="pun">,</span><span class="pln"> </span><span class="typ">CmsResource</span><span class="pln"> resource</span><span class="pun">)</span><span class="pln"> </span><span class="kwd">throws</span><span class="pln"> </span><span class="typ">Exception</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    </span><span class="typ">CmsObject</span><span class="pln"> cmso </span><span class="pun">=</span><span class="pln"> cms</span><span class="pun">.</span><span class="pln">getCmsObject</span><span class="pun">();</span><span class="pln">
    </span><span class="typ">String</span><span class="pln"> sitePath </span><span class="pun">=</span><span class="pln"> cmso</span><span class="pun">.</span><span class="pln">getSitePath</span><span class="pun">(</span><span class="pln">resource</span><span class="pun">);</span><span class="pln">

    </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">cmso</span><span class="pun">.</span><span class="pln">readAllAvailableVersions</span><span class="pun">(</span><span class="pln">sitePath</span><span class="pun">).</span><span class="pln">size</span><span class="pun">()</span><span class="pln"> </span><span class="pun">></span><span class="pln"> </span><span class="lit">0</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
        I_CmsHistoryResource histRes </span><span class="pun">=</span><span class="pln"> cmso</span><span class="pun">.</span><span class="pln">readAllAvailableVersions</span><span class="pun">(</span><span class="pln">sitePath</span><span class="pun">).</span><span class="pln">get</span><span class="pun">(</span><span class="lit">0</span><span class="pun">);</span><span class="pln">
        </span><span class="kwd">int</span><span class="pln"> publishTag </span><span class="pun">=</span><span class="pln"> histRes</span><span class="pun">.</span><span class="pln">getPublishTag</span><span class="pun">();</span><span class="pln">
        </span><span class="typ">CmsHistoryProject</span><span class="pln"> project </span><span class="pun">=</span><span class="pln"> cmso</span><span class="pun">.</span><span class="pln">readHistoryProject</span><span class="pun">(</span><span class="pln">publishTag</span><span class="pun">);</span><span class="pln">            
        </span><span class="kwd">return</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Date</span><span class="pun">(</span><span class="pln">project</span><span class="pun">.</span><span class="pln">getPublishingDate</span><span class="pun">());</span><span class="pln">                                   
    </span><span class="pun">}</span><span class="pln"> </span><span class="kwd">else</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
        </span><span class="kwd">return</span><span class="pln"> </span><span class="kwd">null</span><span class="pun">;</span><span class="pln">
    </span><span class="pun">}</span><span class="pln">   
</span><span class="pun">}

I'm wondering whether it could be accomplished in another way.

--
Chris Christoph P. U. Kukulies kukulies (at) rwth-aachen.de
</span></code></pre>
    <br>
  </body>
</html>