Click here to Skip to main content
15,891,923 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello everybody

am working on a website which has 6 pages , each one with its menu

so i have created 6 menus :home: about us: contact: portfolio: partners: forum;

so my question is ,if i want to change home page, is there a way to change one page and other pages being change automatically , without going to change one page after another...

i just wanted to know a way to change one page , and other remaining pages get affected ..( am using php)



regards
Posted

If you are using Dreamweaver then you can automatically change or fix site-wide links.
 
Share this answer
 
Assuming your web server is configured to allow it, use server-side includes. In PHP, this is done by using the include(path) directive.

Put your menu code in a single file, with all the HTML mark-up that you need. By convention, I give all included files an extension of .inc, to remind me that the file is a fragment that cannot stand on its own. Then place <?php include("Menus.inc"); ?> within your PHP page at the exact place where you want the fragment to be included. When the PHP page is retrieved, the first thing the web server will do is merge the include into the page and then perform any additional processing before sending it to the user. Your page should look something like this:
HTML
<html>
  <head>
    ...
  </head>
  <body>
    <?php include("Menus.inc"); ?>
    <p>...</p>
  </body>
</html>


To maintain the menus, just alter the .inc file; the pages will include the updated file automatically. There are a number of variations on how to to do this, and different functions, so you should probably do some research on the web to find exactly what you need.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900