ASP and HTML
A very useful feature in most server-side languages is the ability
to include files. Including a file means to take the contents of an outside
file and put it into a page when it is requested by a user. This saves
you time by not having to put common HTML code in every page, and it saves
server space because you only have one file with a bunch of the same code
instead of many. To include a file, you use either of the following two
Server Side Includes(SSI) tags.
|
<!--#include virtual=""-->
or
<!--#include file=""-->
|
Those two tags take an outside file located on the server and copies
and pastes the text inside them into the calling page(the calling page
meaning the page containing the SSI tag). Inside the quotes "",
you put the path to the file. Whats the difference between file and
virtual? you say. Well when you use #include virtual, you specify
the path to the file relative to the template file. So you might use something
like: <!--#include virtual="/include/header.html"--> But
with #include file, you either must have to have the two files in the
same directory(folder) or you must specify the full windows or unix path.
Example:
|
<!--#include file="c:\inetpub\wwwpub\mypage\header.html"-->
or
<!--#include file="/pub/usr/johndoe/header.html"-->
|
You can include files the same way in HTML and ASP. But with HTML, if
you are on a Windows NT server, the file with SSI includes in it must
have the extension .SHTML and the ASP file must have extension
.ASP.
Cold Fusion
It is just as easy to include files in Cold Fusion tool; you include
a file by using the CFINCLUDE tag like this:
|
<CFINCLUDE TEMPLATE="template_name">
|
You put the path of the file you want to include inside the quotes. NOTE:
the path must be UNIX relative to the calling file.