Menus are one of the best reasons for using include files. A lot of the time a site will change its structure and this means changes to the menu. Menus are usually a global item in a site and should remain constant throughout the web site.
Nuts Own Code

Asp Directory

Nuts Web Search
Web Directory
Web Search

Nuts ASP Code
Functions
Scripts
Tutorials
Wizards
Fonts
Download Fonts
Download Dll Files
Dll Files
Relaxing Games
Online Games
Take Our Poll
Do you use .Net?
Yes
No
Not Yet
Dot What?
Really, Take It!
Get The Source
About Nuts4Asp
Privacy
Contact Us
Arts
Movies, Television, Music
Business
Jobs, Industries, Investing
Computers
Internet, Software, Hardware
Games
Video Games, RPGs, Gambling
Health
Fitness, Medicine, Alternative
Home
Family, Consumers, Cooking
Kids and Teens
Arts, School Time, Teen Life
News
Media, Newspapers, Weather
Reference
Maps, Education, Libraries
Regional
US, Canada, UK, Europe
Science
Biology, Psychology, Physics
Sports
Baseball, Soccer, Basketball
World
Deutsch, Español, Français, Italiano, Japanese, Nederlands, Polska, Svenska
Help build the largest human-edited directory of the web
Take this site for example. Things are being added and updated almost daily and this often requires editing the menu. By putting the menu in an include file I simply make a change to one page and every page in the site is immediately updated.

Now you can do the same thing to. It's very simple. Just open a new page in your editor and copy the menu portion into this page. Name it something like menu.htm. Then place it in a directory specifically for include files. This will make it easy to get to the includes when it is time to edit them. 

One important thing to note is any images in the menu will probably be in your image directory. This will cause them not to show if you don't write the path correctly. Many people use this method to point to the image:

<img border="0" src="imgages/myImage.gif">

This will point to the image only if the page is in the root of the web.

A better way to do this is to define the image source this way:

<img border="0" src="/imgages/myImage.gif">

By putting the / in front of the name of the directory that the image is in tells the server to start in the root of the web and find the images directory and then the image in question.

Now that you have the image path defined, your menu include file is is ready for use. On each page edit the source where you want the menu to appear by adding this line:

<!-- #Include Virtual="include/menu.htm">

Now note there is NO / in front of the directory named include as we did with the image above. The reason for this is simple. When the server reads the word Virtual in the include line it knows to start in the root of the web and then follow the path to the desired file.

More ways to use include files.

Bad or missing query parameters in request.

Copyright © 2001-2008 Nuts4Asp.com
All other names used are property or copyright of their respective owners.