Ok after some tweaking based on your idea I came up with

<jsp:scriptlet> 
<![CDATA[
    Content activePage = Resource.getActivePage(request);
     MetaData md = activePage.getMetaData();
     out.write(md.getModificationDate().getTime().toLocaleString());
     // ... or set it for multiple use
     // pageContext.setAttribute("lastModified",
//md.getModificationDate().getTime().toLocaleString());
]]> 
</jsp:scriptlet>

And it does the trick....

Question remains though why not expose MetaData via setNode tag....Seems
like a logical idea...Something like:

<!-- exposes the current node for use with jstl -->
<cms:setNode var="currentPage" scope="request"/>

${currentPage.metaData.lastModified)



I am not a big fan of the scriptlets....:)))


Amir




-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 08, 2007 8:23 PM
To: [email protected]
Subject: Re: [magnolia-user] getting author, created date, revised date

Amir,

It is actually quite easy to access the page's meta data. The Content  
class has a method called 'getMetaData()' to retrieve the Meta Data  
of a page. The result of the method is a MetaData object, offering  
you a lot of methods to directly read meta data of a content page.

Here is a simple sample:

   <%
     HierarchyManager hm = MgnlContext.getHierarchyManager("website");
     Content myPage = hm.getContent("/en/about-magnolia");
     MetaData md = myPage.getMetaData();
     out.write(md.getModificationDate());
   %>

Check the Magnolia API to see what methods are available in the  
MetaData object.
http://documentation.magnolia.info/docs/en/developer/magnolia_api.html

hth
Giancarlo
www.xumak.com


On Mar 8, 2007, at 2:08 PM, Amir Mistric wrote:

> Ok
>
> I just looked up user list archive for a proper way to get lets say  
> last
> modified date of a page...
> I found several solutions ranging from snippets, cmsu:date tag and  
> cms:out
> tag....
>
> What is the "proper" way to obtain these items?
> Is it via JCR query?
> If so can someone tell me which subnode in MetaData should be used?
>
>
> Looking at the metadata for "en" page there are 2 subnodes for  
> creation and
> modification dates...
> What is the difference and which one should be used  
> (mgnl:creationdate or
> jcr:created)?
>
>
> /en/MetaData
> /en/MetaData/mgnl:authorid=superuser
> /en/MetaData/jcr:uuid=e09c45fb-3408-433f-8109-d5fc4cf7e8aa
> /en/MetaData/mgnl:creationdate=2006-11-06T17:18:58.562+01:00
> /en/MetaData/mgnl:lastaction=2006-11-14T19:40:49.007+01:00
> /en/MetaData/jcr:created=2006-12-28T14:56:20.964-05:00
> /en/MetaData/jcr:baseVersion=9a4d2642-8865-4ea4-8c8a-63a0d27542b4
> /en/MetaData/jcr:isCheckedOut=true
> /en/MetaData/mgnl:lastmodified=2006-11-07T17:03:05.171+01:00
> /en/MetaData/jcr:primaryType=mgnl:metaData
> /en/MetaData/mgnl:activatorid=superuser
> /en/MetaData/jcr:predecessors=9a4d2642-8865-4ea4-8c8a-63a0d27542b4
>
> /en/MetaData/jcr:versionHistory=0520e128-49b4-4d9a-8628-a586dbb96997
> /en/MetaData/mgnl:template=siteDesignerContent
> /en/MetaData/mgnl:activated=true
>
>
>
> Thanks
> Amir
>
>
> ----------------------------------------------------------------
> for list details see
> http://www.magnolia.info/en/developer.html
> ----------------------------------------------------------------
>


----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/developer.html
----------------------------------------------------------------


----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/developer.html
----------------------------------------------------------------

Reply via email to