PDA

View Full Version : Ajax Pagination script help!



Wol
09-18-2007, 02:48 PM
1) Script Title: Ajax Pagination script

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

3) Describe problem: I have intergrated this script into my site (http://www.owlwebs.co.uk/sites.html) but for some reason i have lost the previous and next arrows from the navigation? I have trawled through the code (i am not fluent in most forms of code!) but i can find no reference to these arrows? I am aware this will prbably be something amazingly obvious but please help me!

Many thanks in advance

Wol

p.s. also the script wont open directly onto the first page either?! thanks again if you can help!

boogyman
09-18-2007, 03:10 PM
ajaxpageclass.bindpages.prototype={

buildpagination:function(selectedpage){
if (this.pageinfo.page.length==1)
var paginateHTML="Page 1 of 1" //Pagination HTML to show when there's only 1 page (no pagination needed)
else{ //construct pagimation interface
var paginateHTML='<div class="pagination"><ul>\n'
paginateHTML+='<li><a href="#previous" rel="'+(selectedpage-1)+'"> </a></li>\n'
for (var i=0; i<this.pageinfo.page.length; i++){
paginateHTML+='<li><a href="#page'+(i+1)+'" rel="'+i+'">'+(i+1)+'</a></li>\n'
}
paginateHTML+='<li><a href="#next" rel="'+(selectedpage+1)+'">next </a></li>\n'[/icode]
paginateHTML+='</ul></div>'


change that to &laquo; and &raquo; respectively

Wol
09-18-2007, 04:25 PM
Cheers for that!! If you can also tell how to make it start on the first page instead of having to click on the number one it would be great!!

boogyman
09-18-2007, 05:50 PM
when you link to that page add the number you wish to start on eg
page1


<a href="/sites.html#page1>Link</a>

page2


<a href="/sites.html#page2>Link</a>

page3


<a href="/sites.html#page3>Link</a>

ddadmin
09-18-2007, 08:15 PM
Actually, the problem is because there's a error with the way you set up the script:



var mypages=new ajaxpageclass.bindpages(myajaxbook, "pcontent", ["paginate-top", "paginate-bottom"])

You need to remove the last parameter, since you don't have a corresponding "paginate-bottom" DIV defined on the page. In other words, change that to:



var mypages=new ajaxpageclass.bindpages(myajaxbook, "pcontent", ["paginate-top"])

boogyman
09-18-2007, 08:25 PM
var mypages=new ajaxpageclass.bindpages(myajaxbook, "pcontent", ["paginate-top"])

wouldn't you get rid of the square brackets too? those are to say which parameters are optional


var mypages=new ajaxpageclass.bindpages(myajaxbook, "pcontent", "paginate-top")

ddadmin
09-18-2007, 08:39 PM
wouldn't you get rid of the square brackets too?

No, since the 3rd parameter expects an array, which the bracket is for.