General HTML/Web Design Programming Q`s/website menu bar


I have a website with many sub-pages and sub-sub-pages.
I want to simplify design with a menu-bar in top that is common to all pages to navigate quick to each of the main areas. about a dosen entryes. What is the best way to do this ? maybe a 2 line bar for
main and sub pages
Best way I found is use an image and cursor positions to click part of it but then the links and parts still need to be in each page ?
Is there a way to make every page call the same menu so when I make a change it will be correct in all pages ? instead of edit every page manually.  also look for good tutorials for php coding

Assuming that your pages have the extension PHP (example: index.php) and a menu is created inside of menu.php, then you can call in the external code from that page by putting the following code into index.php [or other pages] where you want that menu to appear.

<?php include('menu.php'); ?>

For example.. let's say your menu is css styled but uses a line code such as this...

 <li>item 1</li>
 <li>item 2</li>
 <li>item 3</li>

Then you would simply put this in the index.php (or other page)...

<?php include('menu.php'); ?>

And then put this in the menu.php page...

 <li>item 1</li>
 <li>item 2</li>
 <li>item 3</li>

The menu.php page should have no other code in it except for that code that you want to appear in between the UL tags as seen illustrated.

Now you can just add or delete menu items from the menu.php page and it will change throughout the entire site where you have this php code implimented.

Also... even though the pages that have the PHP code in it should be a php extension, the menu page can have any extension you want as long as it don't have php code.  In other words, the following codes will also work...

<?php include('menu.htm'); ?>
<?php include('menu.html'); ?>
<?php include('menu.txt'); ?>

BUt be sure to remember file paths as well.  For example, if menu.php is in a folder called 'inc' but the index.php page is not then use...

<?php include('inc/menu.php'); ?>

Also... keep in mind that the code in the menu.php page needs to act as if it is in the same page as the index.php page.  For example, you don't want to link back using ../nextPage.php just because menu.php is in the inc folder.  

General HTML/Web Design Programming Q`s

All Answers

Answers by Expert:

Ask Experts


John Martin


I am able to answer any web design related questions including but not limited to html, dhtml, xml, wml, css, php, flash, swf and WAP. I have computers and electronics experience dating before the Military where I served as a tactical telecommunication com center operator in Military Intelligence during Desert Storm (and Desert Shield). I have a total of 22 consecutive years of computer experience (since age 14) and also teach computer classes locally. I also know little known secrets to making money online and SEO.


22 years of consecutive computer related jobs, hobbies and Military operations.

Personal experience, US Military Intelligence experience, Schooling and Signal Corp. Training as well.

Awards and Honors
Army accommodation medal and a two week advancement in A.I.T. training due to already existent computer knowledge at the time.

©2017 All rights reserved.