Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    POP
    POP is offline
    New to the CF scene
    Join Date
    Nov 2006
    Location
    New Zealand
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Is there a limit to History.go()?

    Hi all

    I have a small website for displaying my pictures to the world ( www.pictures-of-paradise.com ), and have just added 'prev' and 'next' buttons to the 'display' page. You get to the display page from the 'categories_grab' page where all the images in the category that has been chosen are displayed as thumbnails.

    I wanted to be able to return to the 'categories_grab' page at the same position it was when a thumb is clicked, so I made a variable '$num_clicks' and pass this in the command line, incrementing it by -1 everytime one of the buttons is clicked, and then in the 'anchor' attached to the picture I put <a href='javascript: history.go($num_clicks)' target='_self'>.

    Everything is working fine, until it reaches -50 when it stops working...

    Is there a limit to the number of histories 'history.go()' will access? Or is it something else I am doing wrong? Any ideas or suggestions please

    Thanks in advance for any help anyone can give.
    POP

  • #2
    Registered User
    Join Date
    Oct 2004
    Posts
    592
    Thanks
    0
    Thanked 1 Time in 1 Post
    History.go may not be better idea.


    My Pseudo normally flows as

    Code:
    Assume:
    currentImageNum = 0;
    totalImageNum = 50
    
    ### For Next Button ### 
    
    if currentImageNum < (totalImageNum-1)
       currentImageNum++;
    else 
      currentImageNum = 0;
    
    call showImage(currentImageNum );
    ###For Prev Button ###
    
    if (currentImageNum > 0 && currentImageNum <> (totalImageNum-1))
       currentImageNum--;
    
      call showImage(currentImageNum );

  • #3
    POP
    POP is offline
    New to the CF scene
    Join Date
    Nov 2006
    Location
    New Zealand
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Iota, thanks for your reply.

    I'm not sure you understand the problem...

    First I should note that I am using 'PHP' for my coding, I forgot to mention that before. I'm fairly new to all this by the way.

    The problem is not with the navigation buttons, I have them working fine, but if after, either viewing all images in a category with more than 49 images, or just going backwards and forwards through the images more then 49 times, the history.go(-50) fails to function! anything less then (greater than since its a negitive number...) 50 and it works fine, returning you to the 'Categories_grab' page, and scrolled down to the place you left it. So History.go(-49) works, and History.go(-50) fails.

    Perhaps I have not understood your code (that is very likely)...

    POP

  • #4
    POP
    POP is offline
    New to the CF scene
    Join Date
    Nov 2006
    Location
    New Zealand
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, not that im not grateful, but the answer I recieved was in 'code'ish', that made virtually no sense to me (being a part time human), and didn't even answer my question, as far as I can tell.

    For anyone that is interested, the limit to History.go() that I am experiencing is infact in the number of history states saved by the browser... Simple eh.

    Now the problem is returning to the Categories_grab page, scrolled down to the same place, but I dont really hold out any hope of getting a reply that I can understand here, but I will check it out for awhile.

    Laters

  • #5
    Regular Coder
    Join Date
    Jan 2005
    Posts
    153
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yeah common sense tells me that the history.go() just goes back like a web browser, which stores the previous pages on the local computer. To save space, they have to limit the amount of pages they save. That's just my guess so don't quote me.

    And I don't think it's possible to return to the page at the same spot unless you use "anchors" (e.g. <a href="http://blah.com/pics.html#picture_1">Pic</a> ... <img src="http://blah.com/pics/picture_1.jpg" name="picture_1" />) That should link to the picture. With php, you could have it make the anchor the picture id, if you're linking to pics from a database, and then the Back to the Categories link could be something like <a href="http://blah.com/pics.php#<insert ID with PHP here">Link</a>. I hope that helps.

  • #6
    POP
    POP is offline
    New to the CF scene
    Join Date
    Nov 2006
    Location
    New Zealand
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm not sure yet will have to research your suggestions, but they sound hopeful actually, using the pictures id (which I would have to give them ) is promising, since I was unsure about going to an anchor on a page made by php. Will have a look.

    Thanks very much Yaggles, you must be part human aswell

    POP

  • #7
    POP
    POP is offline
    New to the CF scene
    Join Date
    Nov 2006
    Location
    New Zealand
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Me again

    I gave the thumbs a 'name' each and passed it to the 'display page' in the command line.

    When using an anchor with php and passing arguements im not sure of the syntax... I tried "<a href='categories_grab.php#$image_id?cat=$cat&num_images=$num_images'>" but it loaded the page with '0 images'. I removed the anchor, e.g. "<a href='categories_grab.php?cat=$cat&num_images=$num_images'>" and the page loaded fine.

    Is there a problem with my syntax, or is there a problem with going to an anchor on a php page that possibly has not yet been created?

    POP


  •  

    Posting Permissions

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