Results 1 to 4 of 4

Thread: Help with Navigation Menu

  1. #1
    Join Date
    Jun 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help with Navigation Menu

    I run a CSS based site with 2 columns and a header. It is a fitness site that contains about 40 pages, and we will be adding new atricles and will bring it up to nearly 300 pages. I am trying to establish my navigation menu so that If I were to have a change of the menu sometime in the future, that I could edit it from one spot, and not have to modify it on 300 different pages for this to take affect.

    I have been unable to locate any help documents on this tpoice, so if anyone knows of any, or can steer me in the right direction, Id appreciate it.

    Thanks

  2. #2
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    Do your server (by chance) allow server-side (PHP)?
    If so, then you might find PHP include() useful.
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  3. #3
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default PHP is the way to go

    This assumes your web server has php installed.

    Put your main navigation into a text file. Name it main_nav.php . There should not be anything else in this file. For example:

    Code:
    	<div class="clearfix" id="nav">
    		<ul>
    			<li id="t-home"><a href="/index.php">Home</a></li>
    			<li id="t-practice"><a href="/practice_areas.php">Practice Areas</a></li>
    			<li id="t-about"><a href="/about.php">About</a></li>
    			<li id="t-fees"><a href="/legal_fees.php">Legal Fees</a></li>
    			<li id="t-contact"><a href="/contact.php">Contact</a></li>
    			<!-- <li id="t-blog"><a href="/blog/">Blog</a></li> -->
    		</ul>
    	</div> <!-- end nav -->
    Then in the HTML for each page, put this where ever you want the main nav to appear:

    Code:
    <?php
    
    include ("main_nav.php");
    
    ?>
    Save you html files as "filename.php" .

    Now whenever you change your main_nav.php file, the changes will display on every page where you have included the above php code.

    You can expand this idea to the header and footer as well. So if your header or footer ever changes, you'll only have to make changes in one place.

    If anyone is reading this that has not mastered this technique, you owe it to yourself to learn how to do it.

    Good luck,

    Jason

  4. #4
    Join Date
    Jul 2008
    Posts
    2
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Yes, use a PHP include. It will make life easier! And like Jason said, you can expand it to the footer as well. Or expand to anything that will be repeated on several/all pages. No point in having to edit dozens of pages when you can update one file.

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
  •