Technote Details :: How to store the menu in a single file

Issue

For a large site, I want to create the menu only once, in a file, and then display the menu on every page of the site.

Reason

This is a good way of reusing code, by placing repetitive items in a file that is called by other pages.

Solution

To accomplish this, take the following steps:

  1. Create a new page in Dreamweaver and add the CSS menu to it. (e.g. menu.php)
  2. Switch to code view and  manually remove the page directive (from top of the page - the <DOCTYPE > tag), the <html><head> and <body> opening and closing tags - leaving only the code that outputs the menu.
  3. Create the pages for your site. In the place where you want the menu to appear, include the file containing the menu. This is done differently for the various server models:
    • For PHP:
      <?php include('menu.php');?>
    • For ASP VBScript:
       <!-- #include file="menu.asp" -->
    • For ColdFusion:
      <cfinclude template = 'menu.cfm'>

When you need to edit the CSS menu, you must follow the next steps:

  1. Open the menu file in Dreamweaver.
  2. Switch to code view and add the opening and closing <body> </body> tags around the menu code.
  3. Edit the server behavior for the menu to apply the changes.
  4. Remove the <body> and </body> tags from the page and save it.

Home > Support > Knowledge Base > Technote Details
Search the Knowledge Base
© Adobe Systems Romania. All rights reserved.