[opencms-dev] Get Content's Last Modified Date

Nicholas DeSteffen ndesteffen at tlcontact.com
Wed Jan 9 16:53:00 CET 2008


Sweet, I had to do it a little different, might be different versions, I'm on 7.0.3

 

org.opencms.flex.CmsFlexController controller =  org.opencms.flex.CmsFlexController.getController(request);

org.opencms.file.CmsObject object = controller.getCmsObject();

org.opencms.file.CmsResource resource = object.readResource(object.getRequestContext().getUri());

java.util.Date date = new java.util.Date(resource.getDateContent());

 

I had tried something similar earlier, the line in bold is where I was going wrong.

 

Thank you very much!!

Nick

  _____  

From: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] On Behalf Of karl adenener
Sent: Wednesday, January 09, 2008 12:30 AM
To: The OpenCms mailing list
Subject: Re: [opencms-dev] Get Content's Last Modified Date

 


Hi Nick, 

you know this?

CmsTemplateModules cms     = new CmsTemplateModules(pageContext, request, response);
CmsObject cmso        = cms.getCmsObject();
CmsResource cmsr    = cmso.readResource( uri );
CmsFile file               = new CmsFile( cmsr ); // or Ressource or Folder
file.getDateContent() // Returns the date of the last modification of the content of this resource.

For me it is working fine.

Aden

  _____  

Date: Tue, 8 Jan 2008 12:05:31 -0600
From: ndesteffen at tlcontact.com
To: opencms-dev at opencms.org
Subject: [opencms-dev] Get Content's Last Modified Date

Hi,
I'm trying to get the date that a page was last modified.  When I use the following code in a .jsp the date that is returned is the modified date of the template.  Any ideas on how to get at the content's date?  It has to be available as its listed in the workspace.

 

org.opencms.flex.CmsFlexController controller = org.opencms.flex.CmsFlexController.getController(request);

java.util.Date expired = new java.util.Date(controller.getDateLastModified());

 

Thanks!

 

Nick DeSteffen

Web Developer - CarePages Inc.

http://www.carepages.com

ndesteffen at tlcontact.com

 

 

----
 
Harness the compassion to help when someone needs
you. We're excited to announce 'We Carry Each
Other,' a collection of inspiring stories and
practical tips on how to cope and care from Eric
and Sharon Langshur, the founders of CarePages.
Look at your local major bookseller or visit
http://www.carepages.com/we_carry.jsp

 

  _____  

Kostenlos bloggen + eigene Homepage + Fotospeicher = MSN Spaces Hier klicken!  <http://clk.atdmt.com/GBL/go/mcrsddsp0020000048gbl/direct/01/> 


----

Harness the compassion to help when someone needs
you. We're excited to announce 'We Carry Each
Other,' a collection of inspiring stories and
practical tips on how to cope and care from Eric
and Sharon Langshur, the founders of CarePages.
Look at your local major bookseller or visit
http://www.carepages.com/we_carry.jsp

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20080109/df1321f9/attachment.htm>


More information about the opencms-dev mailing list