|
Repeating Headers and Footers
Ever get tired of having to retype your header on every new page you create? Have you gone so far as to create a template page, to avoid having to retype your header each time you make a new page, but then found that any changes you make to the header have to be done on every single page in your website? Well we have the solution for you - use an 'include file'!
What is an include file?
An include file is a separate page that is included in your current
web page by using what is called in "include tag". I.E.:
#INCLUDE FILE="header.inc"
The tag can be inserted anywhere on a page. For instance this
page has an include inserted just below the tag, and
another at the bottom of the page just before the
tag. The first include is my header, and the second is my footer.
Using a header and footer include allows me to change the header and
footer content on the fly, and these changes affect all my pages at
once! No more wasted time going through each page making the same
change on each page!
What are the rules?
- Give your page an ASP name:
First of all, if you use an include file in your page and you do
not already have it named as an ASP page (i.e. mypage.asp) then you
will need to save it with the .asp extension.
- Put your header or footer code in a separate page:
Cut and paste your header code into a separate file and save it
with a .inc extension (i.e. header.inc). This will help you
easily identify your include files.
- Place a reference tag for the include file in the appropriate
place in your page:
I tend to put my header and my footer code within it's own
table, so that it doesn't affect any other tables or code with in my
web page. I like to place my header include tag just below my
tag, and my footer include tag just above my
tag.
NOTE: you can use include files anywhere on your page, just make
sure you either put them in their own table, or at least set up any
table tags in the include file that work with the rest of your
page. Otherwise you can end up with quite a messy looking
page.
- Make any header or footer updates in the include file:
If you need to change a link in your footer, or maybe you
recreated your header with new graphics, etc., make the changes in
your include file. By doing this, your changes will be made
automatically to every page in your website that contains an tag
referencing the include page.
|