Results 1 to 7 of 7

Thread: Ajax Pagination script help!

  1. #1
    Join Date
    Sep 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Ajax Pagination script help!

    1) Script Title: Ajax Pagination script

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...nate/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!

  2. #2
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    Quote Originally Posted by Scripts/ajaxpagation.js
    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

  3. #3
    Join Date
    Sep 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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!!

  4. #4
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    when you link to that page add the number you wish to start on eg
    page1
    Code:
    <a href="/sites.html#page1>Link</a>
    page2
    Code:
    <a href="/sites.html#page2>Link</a>
    page3
    Code:
    <a href="/sites.html#page3>Link</a>

  5. #5
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Actually, the problem is because there's a error with the way you set up the script:

    Code:
    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:

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

  6. #6
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    Quote Originally Posted by ddadmin View Post
    Code:
    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

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

  7. #7
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    wouldn't you get rid of the square brackets too?
    No, since the 3rd parameter expects an array, which the bracket is for.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •