AW: [opencms-dev] does in fact nobody knows the answer?

Andreas Zahner Andreas.Zahner at framfab.de
Mon Nov 25 17:45:41 CET 2002


Hi Thomas,

first you have to write a class and extend it from the CmsXmlTemplate class.
In the getContent method you have to place the following code:

	  String filename = cms.getRequestContext().getUri();
        Vector allFiles = cms.readAllFileHeadersForHist(filename);
        if(allFiles.size()>0){
            // we only need the last change
            CmsBackupResource file =
(CmsBackupResource)allFiles.lastElement();
            String username = "";
            try{
                username =
cms.readUser(file.getResourceLastModifiedBy()).getName();
            }catch(CmsException e){
                username = file.getLastModifiedByName();
            }
            template.setData("user", username);
            template.setData("date",
Utils.getNiceDate(file.getDateLastModified()));
        } else {
            template.setData("user", "");
            template.setData("date", "");

        }

Then you have to create an element like this:

<TEMPLATE>
<![CDATA[
Last update: ]]><PROCESS>date</PROCESS><![CDATA[ 
]]><PROCESS>user</PROCESS><![CDATA[
]]>
</TEMPLATE>

and call the element with your new class...
That should do the work!

Andreas Zahner

OpenCms Professional Services
Framfab Deutschland AG
http://www.framfab.de
http://opencms.framfab.de

-----Ursprüngliche Nachricht-----
Von: Thomas Gick [mailto:thomasgick at web.de]
Gesendet: Montag, 25. November 2002 17:31
An: opencms-dev at opencms.com
Betreff: [opencms-dev] does in fact nobody knows the answer?


Hi list,

i posted the following question some days ago. But nobody seems to know the
answer.
The Question: How can i integrate the author and the last modification date
of a requested page in the used xml contenttemplate.
Is there generally the possibility to get these information?

Thomas


____________________________________________________________________________
__
Sie haben mehr zu sagen als in eine SMS passt? Mit WEB.DE FreeMail ist
das jetzt kein Problem mehr! http://freemail.web.de/features/?mc=021182



More information about the opencms-dev mailing list