[opencms-dev] Howto Retrieve the File Type

Andreas Zahner A.Zahner at alkacon.com
Fri Sep 23 12:32:18 CEST 2005


Clayton,

for filtering only special resource types from a folder, use the method:
List result = CmsObject.readResources(foldername,
CmsResourceFilter.DEFAULT.addRequireType(typeID), false);
This returns all resources with the given typeID in the specified folder.

To check the resources type, use CmsResource.getTypeId(). If you want to get
a type name from a given ID, use
OpenCms.getResourceManager().getResourceType(typeID).getTypeName().

HTH, Regards,

Andreas Zahner
Alkacon Software - The OpenCms Experts
http://www.alkacon.com 



-----Original Message-----
From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Corbey, Clayton
Sent: Thursday, September 22, 2005 5:33 PM
To: opencms-dev at opencms.org
Subject: [opencms-dev] Howto Retrieve the File Type 

Hey All,
 
I've drawn a blank on what OpenCms library to use in order to retrieve the
type of file I've loaded into, for example, a menu system.
 
Not the OpenCms properties of the file (it's not in there, I've checked or
else looked in the wrong area), but the actual type; ie: news, event, jsp,
folder, xmlpage, imagegallery, etc.
 
What I want to do is build a page with two columns, one containing news
items on the left and event items on the right; with all the files from one
directory being automatically pulled and sorted. I just can't figure out how
to get the actual type from the system.
 
Any ideas/code?
 
Thanks
 
-Clayton
 
CONFIDENTIALITY NOTICE:  This message is intended only for the use of the
individual or entity to which it is addressed and may contain information
that is privileged, confidential and exempt from disclosure under applicable
law.  If the reader of this message is not the intended recipient you are
hereby notified that any distribution, copying, disclosure and use of, or
reliance on the contents of this transmission is strictly prohibited.  If
you have received this transmission in error, please notify us immediately
by return e-mail and destroy the transmission by deleting the original
message, attachments and all copies.





More information about the opencms-dev mailing list