www.webdeveloper.com
Results 1 to 5 of 5

Thread: Tricky Navigation

  1. #1
    Join Date
    May 2006
    Posts
    6

    Tricky Navigation

    Alright, so I have another question. haha

    I worked on a page a while back and the person who had designed it had set it up so that if you had to update the navigation you could only have to change one file and all the pages would be updated. It wasn't done with frames. I was wondering if anyone knows of a step by step process so that I could use this on my web site. Or if anyone could tell me how to set up so that my navigation was in one file and I didnt have to update it on 30+ pages each time I add a new article.

    Thanks!

  2. #2
    Join Date
    Jun 2005
    Location
    NB, TX
    Posts
    162
    I don't know if it's the answer you're looking for since I don't know your level of coding, but it's easily done in PHP using an include or require. I believe you can also do the same using javascript.

  3. #3
    Join Date
    May 2006
    Posts
    6
    I've done a little php. and could prolly figure that out. What do I need to do for the php include?

  4. #4
    Join Date
    Jun 2005
    Location
    NB, TX
    Posts
    162
    the easiest way is to create one page exactly as you would want it to look, then cut all the navigation portion out of the html (i would have this all in it's own div, by the way... for ease of integration and customization of the navigation links) then create a php page called something like nav.php Then, where your navigation once was in the html page (should be an empty div if you did it as I mentioned) just put this <?php include('nav.php') ?> and it will parse the nav.php page into the html.

    The php page should just consist of the opening <?php ***your code for nav links*** ?> make sure there's no html, head or body tags in the php file or you will have errors all over the place.

  5. #5
    Join Date
    Oct 2005
    Location
    Gold Coast, Australia
    Posts
    2,115
    Use the include() function:
    PHP Code:
    <?php
    // the following will include a file named navigation.html
    include 'navigation.html';
    ?>
    You would then save all pages that have the above code in them with a .php extension.
    Then to change the navigation of your site simply update the navigation.html file

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