PDA

View Full Version : Virtual Pagination Script URGENT HELP NEEDED !



titus
01-18-2007, 10:05 PM
Virtual Pagination Script

http://www.dynamicdrive.com/dynamicindex17/virtualpagination.htm

I have installed the script and it is works great. But I need to name my links, instead of the script automatically naming the links 1,2,3 etc., I would like to name them accordingly, like "home" "about us" etc.,

Does anyone have any Idea how to achieve this?:)

djr33
01-18-2007, 10:40 PM
That's not exactly how the script is designed.... it does a certain amount of blocks per 'page'. However, seems logical enough.

In the .js file, this line (about 1/3 down the page, perhaps) needs to be updated:
virtualpaginate.prototype.paginate_build_selectmenu=function(paginatedropdown){
var instanceOfBox=this
this.selectmenupresent=1
for (var i=0; i<this.pagecount; i++)
paginatedropdown.options[i]=new Option("Page "+(i+1)+" of "+this.pagecount, i)
paginatedropdown.selectedIndex=this.currentpage
paginatedropdown.onchange=function(){
instanceOfBox.showpage(this.selectedIndex)
}
}
That makes each option for the select menu. Page # of total#.
So.... Option("Home") would make ALL of them home.

One possible idea would be to try an array like this:

var pagenames = new Array("home", "links", "contact" )
virtualpaginate.prototype.paginate_build_selectmenu=function(paginatedropdown){
var instanceOfBox=this
this.selectmenupresent=1
for (var i=0; i<this.pagecount; i++)
paginatedropdown.options[i]=new Option(pagenames[i], i)
paginatedropdown.selectedIndex=this.currentpage
paginatedropdown.onchange=function(){
instanceOfBox.showpage(this.selectedIndex)
}
}
(Add the first line, replace the line above with the second line.)

I'm pretty sure that should work for you.

It creates an array, so make sure that the number of 'pages' matches the titles in the array.

tech_support
01-19-2007, 03:04 AM
Wow, Never seen you work in the DD scripts area before :)

Danopoly
05-16-2007, 05:31 PM
Hello,

I'm using "Demo 1" of this script. Is there any way to set up this Array modification mentioned in djr33's code for Demo 1 of this script? (Currently this fix is using the dropdown demo, or "Demo 3")

Thanks for your help!

Dan