Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Linking to something in a Virtual Page?

  1. #1
    Join Date
    Jun 2007
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Linking to something in a Virtual Page?

    1) Script Title: Virtual Pagination

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...pagination.htm

    3) Describe problem: I want to be able to "Bookmark" or "Link to an Anchor" within a Virtual Page. Can this be done? Say I have something on page 3 of 10 that I want to be able to link to from another part of my site...can I do it? How?

    Thanks

  2. #2
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    Please don't ask the same question in two different places.

    For people answering this question, the first question was asked here:
    http://www.dynamicdrive.com/forums/s...ad.php?t=21836
    Thou com'st in such a questionable shape
    Hamlet, Act 1, Scene 4

  3. #3
    Join Date
    Jun 2007
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Still need help

    alex,
    your suggestion in the other thread did not work...


    let's keep this question here it's more apprpriate. Sorry about the double posts...I was a newb to the board. It won't happen again!

    anyway, can someone pease help me with my question?

  4. #4
    Join Date
    Jun 2007
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Still no help? Anyone please?

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Use the:

    Code:
    instance.showpage(page_number)
    as documented on:

    http://www.dynamicdrive.com/dynamici...nation_ref.htm

    in conjunction with this javascript 'get' function:

    Code:
    <script type="text/javascript">
    function getQval(n, m) {
    /*my n=name, m=searchString(optional)*/
    if(!arguments[0]||typeof n!='string')
    return null;
    var r=new RegExp('[?&;]'+n+'=([^&;#]*)'), m=arguments[1]?m:location.search;
    return (m=r.exec(m))? unescape(m[1]) : null;
    }
    </script>
    So, you would have something like (on another page):

    Code:
    <a href="some_page.htm?page=3">Goto Virtual Pagination Page, page 4</a>
    Then on the virtual pagination page (some_page.htm in this example), have:

    Code:
    <script type="text/javascript">
    function getQval(n, m) {
    /*my n=name, m=searchString(optional)*/
    if(!arguments[0]||typeof n!='string')
    return null;
    var r=new RegExp('[?&;]'+n+'=([^&;#]*)'), m=arguments[1]?m:location.search;
    return (m=r.exec(m))? unescape(m[1]) : null;
    }
    if(getQval('page'))
    instance.showpage(getQval('page')*1)
    </script>
    Just put it after the initialization of the virtual page. Also, the instance would need to be the name of the variable used to initialize the virtual content in the first place.

    Like, if using the first demo content:

    Code:
    <!-- Initialize Demo 1 -->
    <script type="text/javascript">
    var gallery=new virtualpaginate("virtualpage", 1)
    gallery.buildpagination("gallerypaginate")
    </script>
    <script type="text/javascript">
    function getQval(n, m) {
    /*my n=name, m=searchString(optional)*/
    if(!arguments[0]||typeof n!='string')
    return null;
    var r=new RegExp('[?&;]'+n+'=([^&;#]*)'), m=arguments[1]?m:location.search;
    return (m=r.exec(m))? unescape(m[1]) : null;
    }
    if(getQval('page'))
    gallery.showpage(getQval('page')*1)
    </script>
    Remember, numbering in javascript usually begins with 0. In this case that means that page 1 is 0, page 2 is 1, etc. So to get page 3 you would use:

    Code:
    <a href="some_page.htm?page=2">Goto Virtual Pagination Page, page 3</a>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I looked into it a little more, and although my first example works, to really get the effect I think we are looking for, this would be better:

    Code:
    <!-- Initialize Demo 1 -->
    <script type="text/javascript">
    var gallery=new virtualpaginate("virtualpage", 1)
    gallery.buildpagination("gallerypaginate")
    
    function getQval(n, m) {
    /*my n=name, m=searchString(optional)*/
    if(!arguments[0]||typeof n!='string')
    return null;
    var r=new RegExp('[?&;]'+n+'=([^&;#]*)'), m=arguments[1]?m:location.search;
    return (m=r.exec(m))? unescape(m[1]) : null;
    }
    if(getQval('page')){
    if(gallery.flatviewpresent)
    gallery.flatviewlinks[gallery.currentpage].className=""
    gallery.currentpage=getQval('page')*1;
    gallery.navigate(getQval('page')*1);
    }
    </script>
    Notes: I combined the initialization and the get code into one script tag block. The key here is that page is the name of the variable passed with the href from the other page linking to this script, and gallery is the variable used to initialize this instance of the script.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Jun 2007
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I don't know what I am doing wrong...but I used the script as you suggested above and it still does not work....

  8. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Well, it is working here so it's possible. There are however at least several ways that the basic script can be setup. I only tested this with the supplied demo, and at that, only with the first of the 5 supplied demos. Is yours like the first demo? Are you trying this with more than one instance of the script? Anyways, a link to your page would help me sort things out.

    Here's a working demo, if that'll help you:

    http://home.comcast.net/~jscheuer1/side/v_page/
    Last edited by jscheuer1; 06-25-2007 at 03:13 AM. Reason: add demo link
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  9. #9
    Join Date
    Jun 2007
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Got it to work! Thanks for your help!

  10. #10
    Join Date
    Jun 2007
    Posts
    10
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default problems using flash buttons

    I've tried to use this method: <a href="some_page.htm?page=2">Goto Virtual Pagination Page, page 3</a> in a flash button, with the following code:

    Code:
    on (release) { getURL("some_page.htm?page=2");}
    But it doesn't work, I don't know why 'cause it works fine trough html.

    Thanks in advance

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
  •