Hello,

another way is to use the displaytag: http://displaytag.sourceforge.net/11/

with jspx the code for a paged search result will look like this:

<jsp:root version="1.2" xmlns:jsp="http://java.sun.com/JSP/Page";
        xmlns:cms="cms-taglib"
        xmlns:cmsu="cms-util-taglib"
        xmlns:c="http://java.sun.com/jsp/jstl/core";
        xmlns:fmt="http://java.sun.com/jsp/jstl/fmt";
        xmlns:display="http://displaytag.sf.net";>

        <jsp:directive.page contentType="text/html; charset=UTF-8" />
                
        <c:if test="${not empty query}">
                <cmsu:simpleSearch query="${query}" var="results" />
<display:table id="node" name="${results}" pagesize="10" requestURI="${contextPath}${actpage.handle}.html">
                        <display:column>
<div style="float:left;"><a href="${contextPath}$ {node.handle}.html" title="${node.title}"><b>${node.title}</b></a></div> <div style="float:right;"><fmt:formatDate value="$ {node.metaData.modificationDate.time}" pattern="dd MMM yyyy"/></div>
                                <br/><br/>
                                <cmsu:searchResultSnippet query="${query}" 
page="${node}" />
                                <br/><br/>
<a href="${contextPath}${node.handle}.html" title="${node.title}">$ {node.handle}.html</a>
                                <br/><br/>
                        </display:column>
                </display:table>
        </c:if>
        
</jsp:root>

HTH

Tom

On 06.11.2008, at 17:11, Lrkwz wrote:


Thank you for the suggestion; I ended up with

<jsp:scriptlet>
   long begin = 0;
   long end = NUM_NEWS_PER_PAGE -1;
   ArrayList it = null;
   try{
       it =
(ArrayList )Resource.getCurrentActivePage().getContent("faqVoce").getChildren()
;
       Collections.reverse(it);
       pageContext.setAttribute("myCollection", it);

       begin = getPage(request, "begin");
       end = begin + NUM_NEWS_PER_PAGE -1;
   } catch( PathNotFoundException e) {
       begin = 0;
       end = NUM_NEWS_PER_PAGE -1;
       it = new ArrayList();
   }

   pageContext.setAttribute( "begin", new Long(begin) );
   pageContext.setAttribute( "end", new Long(end) );
</jsp:scriptlet>

// ...

   <cms:contentNodeIterator contentNodeCollectionName="faqVoce"
items="${myCollection}" begin="${begin}" end="${end}" varStatus="curStatus"

<!-- NOTICE THIS IF -->
       <c:if test="${curStatus.index le end }">
...
       </c:if>
   </cms:contentNodeIterator>

Oddly enough the end attribute of the contentNodeIterator tag has a strange
behaviour:

If the collection contains 10 elements and you initialize NUM_NEWS_PER_PAGE
= 1:
* first page has 1 element (starting with the 0st)
* second page has two (starting with 1st)
* fifth page has five elements (starting with 4th)
* sixth page has four (!)
* ...
* nineth page has two
* 10th page has one element

--
View this message in context: 
http://www.nabble.com/Paged-news-tp20231805p20364160.html
Sent from the Magnolia - User mailing list archive at Nabble.com.


----------------------------------------------------------------
for list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
----------------------------------------------------------------

--
Leitung Bereich Entwicklung & Programmierung

esense GmbH
Leonhardsstrasse 37
CH-4051 Basel

[EMAIL PROTECTED]
+41 (0)61 271 35 01
http://www.esense.ch

Gute Webseiten sind selten. Einige davon sind von uns.




----------------------------------------------------------------
for list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
----------------------------------------------------------------

Reply via email to