How do you script a menu for all the pages?

He has: 8 posts

Joined: Oct 2004

I have 50 pages on my site. If I changed, add, or delete one links to the menu, I have to do it to all my web pages.

Is there a way I can code the menus so that if I make some changes, I only touch one file instead of 50 pages?

Can it be done on CSS or Javascripts?

Please help!

---------------
"A person who take a risk may sometimes lose but a person who never take a risk always lose" -Sal Valenzuela of CyFocus.com-

CyFocus.com - "high quality yet affordable e-business solutions"

Busy's picture

He has: 6,151 posts

Joined: May 2001

can be done with javascript (include a .js file) but prefered method is with server side (ASP, PHP etc) because if a person has disabled javascript (and some serach engines) will be stuck with a blank page with no navigation

openmind's picture

He has: 945 posts

Joined: Aug 2001

Dependent on your server simply use includes. That way you just change the include to fit...

PHP example:

<?php
include(\"filename.php\")
?>

ASP Example 1:

<?php
<!-- #include virtual=\"/includes/header.asp\" -->
(tells ASP where the file is located relative to the root web directory)
?>

ASP example 2:

<?php
<!-- #include file=\"../includes/header.asp\" -->
(tells ASP where the file is relative to its current directory)
?>

Coldfusion:

<?php
<cfinclude template=\"yourfilename.cfm\">
?>

CptAwesome's picture

He has: 370 posts

Joined: Dec 2004

You can also do it with SSI (server side includes)

<!--#include file="yourfilename.(php,asp,cfm,txt,txt,etc)" -->'

With SSI, you might have to make the pages named .shtml depending on the server configuration.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.