www.webdeveloper.com
Results 1 to 6 of 6

Thread: Problems with menu - help

  1. #1
    Join Date
    Jun 2012
    Posts
    1

    Problems with menu - help

    I'm facing a problem with a PHP based menu. When i click on the menu and one of its child i want i to stay open and not be closed. For example: Music>Dolly Parton.

    Site URL: http://viktorflume.com/

    Cheers. /Eric

  2. #2
    Join Date
    May 2012
    Posts
    59
    easiest way is to use frames/iframes since it's just basic HTML. Though nothing is ever easy without a compromise in that search engines HATE frames and iframes!

    The other way is to use AJAX, much more user friendly, but again, search engines won't find the content loaded by AJAX very easily.

    In PHP, you just need to pass a value back to your menu object. COuld be done in various ways, either via URL or better still, via the session

    Kind regards,
    Scott

  3. #3
    Join Date
    May 2012
    Posts
    42
    Yeah, I'd go with the session option.
    PHP Code:
    <?php
    session_start
    ();
    $_SESSION['cur_nav_section'] = 'Music';
    ?>
    Then use that variable to open your nav menu to the correct section on page load.

  4. #4
    Join Date
    May 2012
    Posts
    59
    Just remember that search engines may not see the pages using sessions... since google bot for example doesn't just use ONE ip address and session to index a site

    Kind regards,
    Scott

  5. #5
    Join Date
    May 2012
    Posts
    42
    Yeah, I wouldn't suggest using sessions to build the menu ... just to "expand" the active menu section. I assume you use some JS to expand the sub-sections (IE: Music) when a user clicks on that section to expand it. I'd use sessions, or even the $_GET variable to keep track of the sub-section the user navigates to. So when the user goes to, say, Dolly Parton, you can use $_SESSION or $_GET to fire your JS that expands the Music section in the nav bar or whatever.

  6. #6
    Join Date
    May 2012
    Posts
    59
    I think $_GET would be best for a persistant solution & use AJAX for a better user experience.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles