[opencms-dev] How to get property values of files in vfs

M Butcher mbutcher at grcomputing.net
Thu Mar 18 21:01:01 CET 2004


I'm working from memory here, so you'd better read the Javadocs first, 
but...

import com.opencms.file.CmsObject;

CmsObject cmso = cms.getCmsObject();
String propertyname = "Title";
 > Vector files = cms.getFilesInFolder(targetFolder);
 > int numFiles = files.size();
 >
 > for(int i=0;i<numFiles ;i++){
 >     //out.println(files.get(i).toString());
       // files is a Vector of com.opencms.file.CmsFile objects.
       String filename = files.get(i).getAbsolutePath();
       String title = cmso.readProperty(filename, propertyname);
       // Do whatever...
 >
 > }

The CmsObject is really important, but it's not really covered in the 
docs that well. You'll definitely want to read the Javadocs for it -- 
you'll find it helpful.

Matt



Thomas Fabbricante wrote:
> I would like to read the values of a few properties in a vector of files.
> 
> I'm having trouble getting the properties from each resource.
> 
> I think I have to use the CmsJspTagInfo object but I'm not sure how to get
> there.
> 
> ..................................
> Vector files = cms.getFilesInFolder(targetFolder);
> int numFiles = files.size();
> 
> for(int i=0;i<numFiles ;i++){
>     //out.println(files.get(i).toString());
> 
>     ?????????.getProperty();
> }
> ..................................
> 
> 
> 
> Much appreciated,
> -tom
> 
> 
> 
> 
> 
> ===============================================
> This transmission is confidential and intended
> solely for the person or organization to whom
> it is addressed.  It may contain privileged and
> confidential information.  If you are not the
> intended recipient, you should not copy,
> distribute or take any action in reliance on it.
> 
> If you have received this transmission in error,
> please notify the sender at the e-mail address above.
> ================================================
> 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev




More information about the opencms-dev mailing list