PDA

View Full Version : How to stop the loop?



ata_gp
12-19-2007, 02:10 PM
1) Script Title: Virtual Pagination script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/virtualpagination.htm

3) Describe problem:

I'd like to stop the loop pagination when I get to the last page. Now, when you get to the last page of my virtual paginate, if you click "next" you'll get to the first page again. Is there any 'bug' to disable this re-start?

Thanks,
Rafa

ddadmin
12-20-2007, 01:10 AM
Try the below modified virtualpaginate.js file, which dynamically hides the "next" button if the user is currently on the last page.

Moonwalker
12-22-2007, 07:44 PM
ddadmin, sorry to bother you...but is it possible to remove the "previous" link when you're on page 1?

I tried to modify the code, but without any success.

Thx in advance and merry christmas for you all.

Edit:
I just found these lines in the script:

if (this.previousbutton)
this.previousbutton.style.visibility=(pagenumber==0)? "hidden" : "visible"

It works great when you click on the link for page 1. But when you start the page it is visible. You have to click on number 1 to make it invisible. Any ideas how to auto hidden the previous button?

Edit:
One final question (1000 times sorry). Is it possible to change the script to show the pages like this:
previous (when page > 1) | 1 2 3...9 10 11| next

I mean the dots in this script. You see just the first 3 pages and the last 3 pages.

Sorry for bothering you.

thetestingsite
12-22-2007, 07:57 PM
I found a way to hide the buttons by modifying the previous and next links by adding ids to these elements like so:



<a href="#" rel="previous" id="previous_page">Prev</a> <span class="flatview"></span> <a href="#" rel="next" id="next_page">Next</a>


And also editting the javascript to make it hide if the page is page one or hide the next button if it is on the last page. It is attached below.

Hope this helps.

ata_gp
02-06-2008, 09:20 AM
Using this code the pagination works fine, but I can't use external links like "mypage.html?page=1" or "mypage.html?page=2". With this new javascript i can't navigate using these commands. Is there any change in the virtualpaginate.js?

Thanks





<a href="#" rel="previous" id="previous_page">Prev</a> <span class="flatview"></span> <a href="#" rel="next" id="next_page">Next</a>


And also editting the javascript to make it hide if the page is page one or hide the next button if it is on the last page. It is attached below.

Hope this helps.[/QUOTE]

ddadmin
02-06-2008, 06:08 PM
ata_gp, in the future, please start a new thread when asking your own question regarding a script. When you say:


Using this code the pagination works fine, but I can't use external links like "mypage.html?page=1" or "mypage.html?page=2".

Are you talking about using the URL to have a certain virtual page be selected by default when the page loads? Which thread on DD are you basing the technique using?

ata_gp
02-27-2008, 11:14 AM
I'm sorry... I found in this forum an script that allows me going to a certain page using the following code: mypage.html?page=2.

My apologize 'cos I don't find the post where I read it, but it was in this forum.

The point is: If I use the new script to stop the loop my script doesn't work anymore.

Thanks id advance