eHow launches Android app: Get the best of eHow on the go.

How To

How to Use #include in ASP Files

Contributor
By DJ Smith
eHow Contributing Writer
(0 Ratings)
Coding a web page with an #include directive
Coding a web page with an #include directive

The #include directive lets you include elements in a web page such as a form, header, footer, navigation and embed them into another page. It's a great way to keep a uniform look and feel across your entire website. It's also a time saver when having to add new text such as the copyright date or a new navigation menu item. You only have to open one HTML file and make the changes. The change will take place across the entire website. Without the #include file, you would have to open every page on your site and make the changes. This would be time consuming if you had an extensive site.

Difficulty: Moderately Easy
Instructions

Things You'll Need:

  • ASP compatible web server
  1. Step 1

    Name your main web page with the .asp extension so the web server will process the include file and display the page correctly in your web browser.

  2. Step 2
    Header include with another included imbedded into the code
     
    Header include with another included imbedded into the code

    Use a file that is in another directory on the web server. Create a folder on your web server and call it "includes". You can store all your #include files for your site in this folder and find them much quicker than if they were spread around. Enter the following code in the location you would like it to display on your web page.
    <!-- #include virtual ="includes/header.htm" -->

  3. Step 3

    Use a file that is in the same directory on the web server as the page with the #include. This option is best when you only want to use the #include file in just a few places in the website rather than across the entire site. Make sure the file is in the same directory as the page you are adding the #include to.

  4. Step 4

    Add the #include code below in the location you would like it to display on your web page. <!-- #include file ="navigationmenu.htm" -->

References

Subscribe

Post a Comment

Post a Comment

Related Ads

  • Have you done this? Click here to let us know.
I Did This
Get Free Computers Newsletters

Copyright © 1999-2009 eHow, Inc. Use of this web site constitutes acceptance of the eHow Terms of Use and Privacy Policy .   en-US Portions of this page are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License. † requires javascript

eHow Computers
eHow_eHow Technology and Electronics