[opencms-dev] limit numer of hits with contentloop / Attribute pageSize invalid for tag contentcheck according to TLD

Paul-Inge Flakstad flakstad at npolar.no
Fri Apr 16 15:31:18 CEST 2010


Hi Horst

I don't know if that's at all possible using taglib code, but it's definitively doable using scriptlet code.

You could do something like this to loop N times:

<%
CmsJspXmlContentBean cms = new CmsJspXmlContentBean(pageContext, request, response);
boolean editable = true;
int numberOfLoops = 1;
int i = 0;

I_CmsXmlContentContainer container = cms.contentload("singleFile", "/your/file/name.html", editable);

while (container.hasMoreContent()) {
	I_CmsXmlContentContainer loop = cms.contentloop(container, "ElementToLoop");
	while (loop.hasMoreContent() && i < numberOfLoops) {
		out.println(cms.contentshow(loop, "ElementToPrint"));
		out.println(cms.contentshow(loop, "EnotherElementToPrint"));
		i++;
	}
}
%>

HTH,
Paul

> -----Original Message-----
> From: opencms-dev-bounces at opencms.org 
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Horst Jäger
> Sent: 16. april 2010 14:47
> To: The OpenCms mailing list
> Subject: [opencms-dev] limit numer of hits with contentloop / 
> Attribute pageSize invalid for tag contentcheck according to TLD
> 
> 
> Hi,
> 
> I would like to limit the number of hits inside a contentloop to 1.
> 
> I can't limit the number of entries in my Structured data 
> XML, because I need to show all at another place within my site.
> 
> I can't do this like
> 
> <cms:contentloop ifexists="MyItem" pageSize="1" pageIndex="0" >
> 
> because then I get the error:
> 
> Attribute pageSize invalid for tag contentloop according to TLD  
> 
> I found nothind in the docs.
> 
> Any help would be very much appreciated!
> 
> Thanks in advance
> 
> Horst
> 
> 
> 
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, 
> please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
> 


More information about the opencms-dev mailing list