|
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.
|