This topic is locked

Pagination links for next and previous.

5/20/2008 4:25:14 PM
PHPRunner General questions
M
mmponline author

The current pagination link on the list page has a next and previous link. These links, however, do not show the next or previous page, but the next 10 or previous 10 pages. How do I change it so next and previous shows the next or previous page.
Thanks for assistance.

J
Jane 5/21/2008

Stephan,
edit WritePagination function in the include/jsfunctions.js file for this purpose.

M
mmponline author 7/21/2008

Not sure where to change this code. Wnhen clicking next, it must go to the next page. When clicking previous, to the previous page. At the moment it goes to the next group of 10 pages.

{

if (maxpages > 1 && mypage <= maxpages)

{

document.write("<table rows='1' cols='1' align='center' width='95%' border='0'>");

document.write("<tr valign='center'><td align='center'>");

var counterstart = mypage - 9;

if (mypage%10) counterstart = mypage - (mypage%10) + 1;



var counterend = counterstart + 9;

if (counterend > maxpages) counterend = maxpages;



if (counterstart != 1) document.write(GetGotoPageUrlString(1,TEXT_FIRST)+"&nbsp;:&nbsp;"+GetGotoPageUrlString(counterstart - 1,TEXT_PREVIOUS)+"&nbsp;");



document.write("<b>[</b>");



var pad="";

var counter = counterstart;

for(;counter<=counterend;counter++)

{

if (counter != mypage) document.write("&nbsp;" + GetGotoPageUrlString(counter,pad + counter));

else document.write("&nbsp;<b>" + pad + counter + "</b>");

}

document.write("&nbsp;<b>]</b>");

if (counterend != maxpages) document.write("&nbsp;" + GetGotoPageUrlString (counterend + 1,TEXT_NEXT) + "&nbsp;:&nbsp;" + GetGotoPageUrlString(maxpages,TEXT_LAST))



document.write("</td></tr></table>");

}]


Thanks for any help!

J
Jane 7/22/2008

Here is a sample:

if (maxpages > 1 && mypage <= maxpages)

{

document.write("<table rows='1' cols='1' align='center' width='95%' border='0'>");

document.write("<tr valign='center'><td align='center'>");

var counterstart = mypage - 1;

//if (mypage%10) counterstart = mypage - (mypage%10) + 1;
var counterend = counterstart + 1;

if (counterend > maxpages) counterend = maxpages;
if (counterstart != 1) document.write(GetGotoPageUrlString(1,TEXT_FIRST)+"&nbsp;:&nbsp;"+GetGotoPageUrlString(counterstart ,TEXT_PREVIOUS)+"&nbsp;");
document.write("<b>[</b>");
var pad="";

var counter = counterstart;

for(;counter<=counterend+5;counter++)

{

if (counter != mypage) document.write("&nbsp;" + GetGotoPageUrlString(counter,pad + counter));

else document.write("&nbsp;<b>" + pad + counter + "</b>");

}

document.write("&nbsp;<b>]</b>");

if (counterend != maxpages) document.write("&nbsp;" + GetGotoPageUrlString (counterend + 1,TEXT_NEXT) + "&nbsp;:&nbsp;" + GetGotoPageUrlString(maxpages,TEXT_LAST))
document.write("</td></tr></table>");

}

M
mmponline author 7/25/2008

Works fine. For some reason it's just showing a page 0 as well. Don't know why?
First : Previous [ 0 1 2 3 4 5 6 ] Next : Last