[opencms-dev] Contentload tag and pagination : firstOnPage problem

Sandrine Prousteau s.prousteau at eurelis.com
Thu Mar 12 11:25:02 CET 2009


Hi
I'm test some pagination withcontentload listing.
I get correctly a pagination links line, and the listing of my items, and I'm testing the ${info.firstOnPage} macro, but it doesn't work. Strange because ${info.firstResult}, ${info.lastOnPage}, ${info.lasResult} work!!

My jsp is this one:

<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %> 
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<c:set var="page">${param.page}</c:set>
<c:if test="${empty page}"><c:set var="page">1</c:set></c:if>

<cms:contentload collector="allInFolder" param="/fr/_news/news_%(number)|commons_basic_new" pageSize="2" pageIndex="${page}" pageNavLength="3">
<cms:contentinfo var="info" />	
</cms:contentload>

<div style="border:1px solid black;margin-bottom:5px;">
<u>Infos générales</u> : <br/>
Nombre de résultats ${info.resultSize}<br/>
Page ${info.pageIndex} sur ${info.pageCount}<br/>
${info.pageSize} résultats par page<br/>
Navigation : 
<c:forEach var="i" begin="${info.pageNavStartIndex}" end="${info.pageNavEndIndex}">
        <c:choose>
                <c:when test="${info.pageIndex==i}"><b> Page ${i}</b> </c:when>
                <c:otherwise><a href="<cms:link><cms:info property="opencms.request.uri"/>?page=${i}</cms:link>"> » Page ${i}</a></c:otherwise>
        </c:choose>
</c:forEach>
</div>

<cms:editable />
<cms:contentload collector="allInFolder" param="/fr/_news/news_%(number)|commons_basic_new" preload="true" pageSize="2" pageIndex="${page}" pageNavLength="3" editable="true">
<cms:contentinfo var="info" />	
<div style="border:1px solid black;margin-bottom:5px;">
<c:if test="${info.resultSize > 0}">
<cms:contentload pageSize="2" pageIndex="${page}" pageNavLength="3" editable="true">
<cms:contentinfo var="info2" />
<cms:contentaccess var="resource" />
<div style="background-color:#eeeeee;">
<u>Résultat</u> : <br/>
N°${info2.resultIndex}/${info2.resultSize} - <b>${resource.filename}</b><br/>
(<c:if test="${info2.firstOnPage}">First on page</c:if>
<c:if test="${info2.firstResult}">First result</c:if>
<c:if test="${info2.lastOnPage}">Last on page</c:if>
<c:if test="${info2.lastResult}">Last result</c:if>)
</div>

</cms:contentload>
</c:if>


</div>
</cms:contentload>



Result is :

Résultat :
N°1/5 - /fr/_news/news5
( First result )
Résultat :
N°2/5 - /fr/_news/news4
( )

[...]

Résultat :
N°5/5 - /fr/_news/news1
( Last on page Last result)


Any idea?



More information about the opencms-dev mailing list