Cms:contentload

From OpenCms Wiki
Revision as of 17:55, 4 July 2011 by Ben (Talk | contribs)
Jump to: navigation, search

There is only a little documentation regarding usage of cms:contentload. This document hopes to expand on that.

Contentload is a tag that will let you load a CMS resource as an object, and manipulate it using jsp tags. More detail is available in the documentation included with OpenCms.

Here is an example where an asterisk is used for pattern matching in the param section:

  <cms:contentload collector="allInFolderPriorityDateDesc" param="${opencms.folder}news${*}.html|news|15" editable="true">
    <%-- create a date object from date value --%>	
    <li>
      <a href="<cms:link><cms:contentshow element="${opencms.filename}" /></cms:link>" title="<cms:contentshow element="Title" />"></a>
      <p><cms:contentshow element="Teaser" /></p>
    </li>
  </cms:contentload>

Important note, if you are running OpenCms 7 or newer, use %(opencms.folder), %(opencms.filename), etc, since the macro syntax is now "%()".

Find more informations about which collector parameters exist and how they work in the source code at org.opencms.file.collectors.*, e.g. CmsDefaultResourceCollector.

Collectors

This section describes a few collectors. You can also find all this in the source code as described above.

  • allInFolderDateReleasedDesc

This gets all resources in a folder sorted in descending order by their publish date.

  • allInFolderDateDesc

This gets all resources in a folder sorted in descending order by their creation date. Type of resource needed and number can be specified in the collector parameter.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox