content:matchingContents

This tag fetches contents based on categorisation etc. That is – it is more of a query-api than a firm binding to contents.

Parameters

Name

Required

Default

Type

Description

id

true

 

String

The result is stored in this variable.

contentTypeDefinitionNames

false

 

Object/String

If stated the tag will only return contents of that content type. Comma separated string with names.

categoryCondition

false

 

Object/String

Here you can state very complex category expressions, including boolean expressions etc. Look at the examples.

maximumNumberOfItems

false

 

Object/String

Lets you state how many items you want. Uses the SQL LIMIT-feature.

freeText

false

 

Object/String

Here you can if you want a free text search as well.

freeTextAttributeNames

false

 

Object/String

If you state free tezt search you should also state what attributes to search in.

fromDate

false

 

Object/Date

This lets you limit the search to only contents with a publishDateTime after this java.util.Date.

toDate

false

 

Object/Date

This lets you limit the search to only contents with a publishDateTime before this java.util.Date.

expireFromDate

false

 

Object/Date

This lets you limit the search to only contents with a expireDateTime after this java.util.Date.

expireToDate

false

 

Object/Date

This lets you limit the search to only contents with a expireDateTime before this java.util.Date.

repositoryIds

false

 

Object/String

This lets you limit the search to only contents in certain repositoryId:s (commaseperated id-list).

languageId

false

 

Object/String

This lets you limit the search to only contents in a certain language version.

versionModifier

false

 

Object/String

This lets you limit the search to only contents modified by a certain user.

cacheResult

false

True

Object/Date

This lets you state if you want the matching result to be cached or not.29 december, 2008

cacheInterval

false

1800

Object/Date

This lets you set the cache period in seconds.

cacheName

false

 

Object/Date

This lets you override the cache name.

cacheKey

false

 

Object/Date

This lets you override the cache key.

 

 

ID-result variable contains:
A list of org.infoglue.cms.entities.content.ContentVO-objects.

 

Examples

The following example gets all articles and news which has the category attribute "Area" categorized as "Medicine".

<content:matchingContents id="articles" contentTypeDefinitionNames="Article,News" categoryCondition="Area=/Areas/Medicine"/>
<c:forEach var="article" items="${articles}" varStatus="count">
  <content:contentAttribute id="Title" contentId="${article.contentId}" attributeName="Title"/>
<c:out value="${Title}"/><br/>
</c:forEach>

The following example gets all articles which has the category attribute "Area" categorized as "Medicine" and the category attribute "Department" categorized as "Finance". If you need “OR” - use [] around the categoryCondition instead of {} as here.

<content:matchingContents id="articles" contentTypeDefinitionNames="Article,News" categoryCondition="{Area=/Areas/Medicine,Department=/Departments/Finance}"/>
<c:forEach var="article" items="${articles}" varStatus="count">
  <content:contentAttribute id="Title" contentId="${article.contentId}" attributeName="Title"/>
  <c:out value="${Title}"/><br/>
</c:forEach>



comments powered by Disqus