Read a property of an arbitrary CmsResource

(Difference between revisions)
Jump to: navigation, search
m
Line 1: Line 1:
 
With scriptlets, you can read the properties of any opencms resource.  
 
With scriptlets, you can read the properties of any opencms resource.  
  
 
+
<source lang="java">
 
   <%@page import="org.opencms.file.CmsProperty"%>
 
   <%@page import="org.opencms.file.CmsProperty"%>
 
   <%
 
   <%
Line 13: Line 13:
 
       String propValue = (prop != null) ? prop.getValue() : null;
 
       String propValue = (prop != null) ? prop.getValue() : null;
 
   %>
 
   %>
 +
</source>

Revision as of 18:06, 4 July 2011

With scriptlets, you can read the properties of any opencms resource.

   <%@page import="org.opencms.file.CmsProperty"%>
   <%
      CmsObject cms;
 
      // .. get the cms object
 
      boolean search = false;
      CmsProperty prop = cms.readPropertyObject("/sites/mysite/my_path/file.ext", "prop_name", search);
 
      String propValue = (prop != null) ? prop.getValue() : null;
   %>
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox