logo

New Response

« Return to the main article

You are replying to:

  1. Hi, i created a different version, this version works on categorized views, doesn't create a link for the current page, adds a previous and next link, if available, shows always 5 links and keeps the current page in the middle, except for begin and end. This is also XHTML compliant.

    Cheers, Marijn.

    @If(@Elements(ArgNames)=0;@Return("");""); StartIndex:=@Member( "start"; @LowerCase( ArgNames ) ); Start:=@If( StartIndex=0; 1; @TextToNumber( @Subset( @Subset( ArgValues; StartIndex ); -1 ) ) ); CountIndex:=@Member( "count"; @LowerCase( ArgNames ) ); Count:=@If(CountIndex=0; 10; @TextToNumber( @Subset( @Subset( ArgValues; CountIndex ); -1 ) ) ); xcount:=Count; nrCurrentPage :=(Start-1)/Count; currentPage:=@Text(nrCurrentPage); viewPath:=DbPath+"?open"; pageString := "<a href=\""+viewPath ;

    REM "We are limited to 250 docs by domino!! (can be changed in serverdoc, but 250 should be enough)."; hitNum := @Min(250;Total); REM "max = 5 items"; TotalPagesTmp := @Integer(hitNum/xcount); nrTest:=@Modulo(hitNum;xcount); TotalPages:=@If(nrTest=0;TotalPagesTmp-1;TotalPagesTmp); adJust := TotalPages; tmpToList := @Explode(@Repeat("<td class=\"p-link\">&&";5);"&&");

    endDate := @Text(@Adjust([01-01-1900];0;0;adJust;0;0;0);"D0S0"); numRange := @Explode(@TextToTime("01/01/1900 - " + endDate)); numList0 := (@TextToTime(numRange) - [01-01-1900]) / 86400; numList1 := @If(@Elements(numList0)<5;numList0;nrCurrentPage<3;@Subset(numList0;5);@Subset(n umList0;nrCurrentPage+3)); numList := @If(@Elements(numList1)>5;@Subset(numList1;-5);numList1);

    textList1 := @Text(numList*xcount+1) + " - " + @Text(@Min((numList + 1)*xcount;hitNum)); textList10 := "&amp;start="+ @Text(numList*xcount+1); txNext10 := "&amp;start="+ @Text(Start+Count); txPrev10 := "&amp;start="+ @Text(Start-Count); textListTmp := @Replace(@Text(numList);currentPage;"<td class=\"p-active\">"); textListTd := @Replace(textListTmp;@Text(numList);tmpToList); tr3:="<td class=\"p-previous\">"+pageString+"&amp;count="+@Text(xcount)+txPrev10+"\">&lt; previous</a>| </td>"; tr2:="<td class=\"p-next\"> | "+pageString+ "&amp;count="+@Text(xcount)+txNext10+"\">next &gt;</a></td>"; tr1:="<table class=\"p-paginator\" cellspacing=\"0\"><tr><td class=\"p-text\">More results:</td>"; rnav1:=tr1+tr3+@Implode(textListTd+pageString+ "&amp;count="+@Text(xcount)+ textList10+"\">" + textList1 + "</a>";"</td>")+tr2+"</td></tr></table>"; rnav2:=tr1+@Implode(textListTd+pageString+ "&amp;count="+@Text(xcount)+ textList10+"\">" + textList1 + "</a>";"</td>")+tr2+"</td></tr></table>"; rnav3:=tr1+tr3+@Implode(textListTd+pageString+ "&amp;count="+@Text(xcount)+ textList10+"\">" + textList1 + "</a>";"</td>")+"</td></tr></table>"; @If(Total < xcount;"&nbsp;"; Start=1;rnav2;(Start+Count)>Total;rnav3;rnav1)

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment: