SitePoint Sponsor

User Tag List

Results 1 to 21 of 21

Thread: Hash Change

  1. #1
    Non-Member
    Join Date
    Jan 2008
    Location
    N43 44.4824', W079 13.9408
    Posts
    2,220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Hash Change

    Hi, I would like to get some help regarding a hash change. The PHP code I have within my page located here, will not load the HTML location within the ID and I have been informed that this script I assume must be added ?

  2. #2
    SitePoint Zealot xzyfer's Avatar
    Join Date
    Mar 2004
    Location
    oz
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    By hash do you mean the stuff after the '#' in a URL?

    If so, this cannot be changed in PHP because it is never actually sent to the server.

  3. #3
    Sploghm bronze trophy Victorinox's Avatar
    Join Date
    Nov 2008
    Posts
    749
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    The OP's page uses jQuery to show and hide divs when menu items are clicked and also specifiying which div is revealed on page load. The problem is that he wishes to use a PHP contact form script that will return to a specific div when submitted.

    Also, as the page is practically a site in a single document, it would be useful for the Back and Forward buttons to work and for specific divs to load directly by URL when their fragment identifier is appended.

    In the hope of fixing all these issues I directed the OP, in the PHP forum, to investigate the jQuery hashchange event plugin - to which he seems to have forgotten to include a link.

  4. #4
    Non-Member
    Join Date
    Jan 2008
    Location
    N43 44.4824', W079 13.9408
    Posts
    2,220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, I did forgot the hashchange event plugin Victor explained the situation

  5. #5
    SitePoint Zealot xzyfer's Avatar
    Join Date
    Mar 2004
    Location
    oz
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could look at YUI's history manager. You can catch events when divs are opened and closed then use the browsers back/forward buttons the step throw the changes in the sequence they were done (without refreshing the page I believe).

  6. #6
    Non-Member
    Join Date
    Jan 2008
    Location
    N43 44.4824', W079 13.9408
    Posts
    2,220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    YUI history manager will cause the HTML page, instead of loading on it's own but rather load within the ID on the same page, If I understood correctly ?

  7. #7
    Non-Member
    Join Date
    Jan 2008
    Location
    N43 44.4824', W079 13.9408
    Posts
    2,220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why does the browsers back & forward button have to be used ? I don't want the end user have this functionality at their finger tips, not understanding!

  8. #8
    Sploghm bronze trophy Victorinox's Avatar
    Join Date
    Nov 2008
    Posts
    749
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Why wouldn't you want the Back and Forward buttons to work? It's basic usability. Although your page is hiding and revealing content with scripting, to the user it will seem to be a conventional website where clicking the main menu loads a new page.

    Let's say you want to show someone your 3D stuff. Is it more convenient and professional to give them a direct URL to that or to have to tell them to go to the site and click on a link in a dropdown menu?

    Back/Forward, direct URLs and the redirection behaviour that you want for your form are all related and I doubt that you can have one without the other.

    Have you tried implementing jQuery hashchange event yet?

  9. #9
    Non-Member
    Join Date
    Jan 2008
    Location
    N43 44.4824', W079 13.9408
    Posts
    2,220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why wouldn't you want the Back and Forward buttons to work? It's basic usability. Although your page is hiding and revealing content with scripting, to the user it will seem to be a conventional website where clicking the main menu loads a new page.

    Let's say you want to show someone your 3D stuff. Is it more convenient and professional to give them a direct URL to that or to have to tell them to go to the site and click on a link in a dropdown menu?

    Back/Forward, direct URLs and the redirection behaviour that you want for your form are all related and I doubt that you can have one without the other.
    Good Point, I assume jQuery Hash change adds this functionality ?
    Have you tried implementing jQuery hashchange event yet?
    I will be, then I'll update

  10. #10
    Non-Member
    Join Date
    Jan 2008
    Location
    N43 44.4824', W079 13.9408
    Posts
    2,220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, I've got the scripted installed on the page although that is all I've done as I wasn't clear to me, how this script gets setup. You can view the page with the script within here.

  11. #11
    Sploghm bronze trophy Victorinox's Avatar
    Join Date
    Nov 2008
    Posts
    749
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Invalid URL.

    Should be: http://www.thecreativesheep.ca/const...ion_site_G.htm

    The script is not at the specified location.

    Hope someone else will be able to pick this up as I'm otherwise engaged for a few days.

  12. #12
    Non-Member
    Join Date
    Jan 2008
    Location
    N43 44.4824', W079 13.9408
    Posts
    2,220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A stupid me. Posting the URL, sorry. What do you mean it's not at a specific location?

  13. #13
    Sploghm bronze trophy Victorinox's Avatar
    Join Date
    Nov 2008
    Posts
    749
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Code HTML4Strict:
    http://www.thecreativesheep.ca/construction/jquery.ba-hashchange.min

    ".js" is missing.

  14. #14
    Non-Member
    Join Date
    Jan 2008
    Location
    N43 44.4824', W079 13.9408
    Posts
    2,220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Complete.

  15. #15
    Non-Member
    Join Date
    Jan 2008
    Location
    N43 44.4824', W079 13.9408
    Posts
    2,220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Victor. I'm assuming it's not simple as just installing the script in the page and it should work?

  16. #16
    Sploghm bronze trophy Victorinox's Avatar
    Join Date
    Nov 2008
    Posts
    749
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    The script is still not active in your page because you have misspelt "src".
    Code HTML4Strict:
    <script scr="http://www.thecreativesheep.ca/construction/jquery.ba-hashchange.min.js" type="text/javascript"></script>
    See the developer's page for instructions. As I said above, I'm busy and can't offer help in depth with this.

    Tip: Firebug has at least two ways of showing whether a script is active.
    1. In the HTML tab, find the script in the head and click on the grey triangle to the left. If the script is present its code will be revealed below.
    2. In the Script tab, there is menu (currently showing "construction_site_G.htm") that lists all the acive script when clicked.

  17. #17
    Non-Member
    Join Date
    Jan 2008
    Location
    N43 44.4824', W079 13.9408
    Posts
    2,220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ooops about the spelling mistake, when you do stuff at 1am as I like to do The script is active. Although you don't have the time to help me make this function as it should, in the meantime I'll read over the documentation and try to decipher what is being said. I only studied a little javascript thus far !

  18. #18
    Sploghm bronze trophy Victorinox's Avatar
    Join Date
    Nov 2008
    Posts
    749
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    If this is still your page then "src" is still "scr" and the script still not active. Perhaps you've forgotten to upload the amended page.

  19. #19
    Non-Member
    Join Date
    Jan 2008
    Location
    N43 44.4824', W079 13.9408
    Posts
    2,220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That page is updated, I didn't do a rename

  20. #20
    Non-Member
    Join Date
    Jan 2008
    Location
    N43 44.4824', W079 13.9408
    Posts
    2,220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Victor, checked out the hasChange script documentation. Their isn't much that I would personally understand, besides the author posting the source code and the source code can be changed to suit whatever needs. I have updated the page with the correct link to the script, fatigue played a part in my previous messages

  21. #21
    Non-Member
    Join Date
    Jan 2008
    Location
    N43 44.4824', W079 13.9408
    Posts
    2,220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Found the documentation here, read over it. His examples don't do anything or is their something I'm missing ?


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
  •