Using Include Files
Written by Eric Smith, Northstar Computer Systems LLC
This tip was included a few weeks ago, but there was some confusion about how to use it. Include files allow you to share code between files without having to duplicate the code everywhere. This has the added benefit of making it easier to modify, test, and maintain ASP code on an ongoing basis.
You can include a file in two ways:
1. If the include file is in the same directory as the file into which you want to include it, you can use this code:
<!–#include file="include.asp" –>
You can add directories to this specification, such as includes/include.asp; however, you can't include a leading slash.
2. If the include file is somewhere else in the web hierarchy, you can specify a web pathname to the include file like this:
<!–#include virtual="/includes/util.asp" –>
This is the easiest and cleanest way to implement an include file, since you don't have to worry about relative pathnames getting messed up if you move files around. Put all your include files in one place, if possible, and reference them from your ASP pages.
Keywords: [
Uncategorized ASP Tips
]
Publication Date: 9/1/1999
|