logo

New Response

« Return to the main article

You are replying to:

  1. I have modified the original code to allow both navigator types (1 - 5 | 6 - 10 and, [1] 2 3 4). In addition, I have included code to add the Previous and Next links depending on where in the search the user is.

    This code requires the TotalHits, Start, Count, and Query fields be present on the form.

    REM "The following variable conrols the type of navigator created, 1 (Example. 1-10 | 11 - 20), 2 (Example: 1 2 3)"; TypeNav:=2;

    @If(TotalHits<=Count;@Return("");"");

    REM "Create beginning anchor"; pageString:="<a href=\"?SearchView&Query=" + Query + "&Count=" + @Text(Count) + "&Start=";

    REM "We are limited to 250 docs by domino!!"; hitNum:=@If(TotalHits > 250;250;TotalHits);

    adJust := @Integer(hitNum/Count); endDate := @Text(@Adjust([01/01/1900];0;0;adJust;0;0;0);"D0S0"); numRange := @Explode(@TextToTime("01/01/1900 - " + endDate)); numList := (@TextToTime(numRange) - [01/01/1900]) / 86400;

    NumListBeg:=numList*Count + 1; NumListEnd:=@Min((numList + 1)*Count;TotalHits); StartNum:=@Integer((Start-1)/Count) + 1; StartNumMod:=@Modulo((Start-1);Count); textList1 := @If(TypeNav=1;@Text(NumListBeg) + " - " + @Text(NumListEnd);TypeNav=2;@Text(NumList + 1);@Return("")); textList10 := @Text(numList * Count + 1); StartText:=@Text(@Subset(@Subset(TextList1;StartNum);-1));

    REM "Recompute list1 and list10"; TextList1Left:=@Text(@If(StartNum=1;"";@Subset(TextList1;StartNum - 1))); TextList1Right:=@Text(@If(StartNum=@Elements(TextList1);"";@Subset(TextList1;-@E lements(TextList1)+StartNum))); TextList10Left:=@Text(@If(StartNum=1;"";@Subset(TextList10;StartNum - 1))); TextList10Right:=@Text(@If(StartNum=@Elements(TextList10);"";@Subset(TextList10; -@Elements(TextList10)+StartNum)));

    REM "Write out HTML"; PrevHTML:=pageString + @Text(@Max(Start-Count;1)) + "&Login=1\">Previous " + @Text(Count) + " results " + @Text(@Max(Start-Count;1)) + " - " + @Text(@Max(Start-Count;1) + Count) + "</a> &nbsp;&nbsp;"; NextHTML:=" &nbsp;&nbsp;" + pageString + @Text(Start+Count) + "&Login=1\">Next " + @Text(Count) + " results " + @Text(Start+Count) + " - " + @Text(TotalHits) + "</a>"; DeviderText:=@If(TypeNav=1;" | ";TypeNav=2;" &nbsp;";" "); TypeHTMLAll:=""+ @Implode(pageString + textList10 + "&Login=1\">" + textList1 + "</a>";DeviderText); TypeHTML:=""+ @If(TextList1Left!="";@Implode(pageString + textList10Left + "&Login=1\">" + textList1Left + "</a>";DeviderText) + DeviderText;"") + "[ " + StartText + " ]" + @If(TextList1Right!="";DeviderText+@Implode(pageString + textList10Right + "&Login=1\">" + textList1Right + "</a>";DeviderText);""); "<p>" + @If(Start=1;"";PrevHTML) + @If(@TextToNumber(@Text(StartNumMod))=0;TypeHTML;TypeHTMLAll) + @If((@TextToNumber(@Text(Start))+@TextToNumber(@Text(Count)))>@TextToNumber(@Tex t(TotalHits));"";NextHTML)

Your Comments

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