Has yourdomain.co.uk or yourdomain.com been taken ?

www.

 

Rules for domain names

BUY Now Windows 2000 Hosting

Home
Dot Net
New
SQL Server Hosting
Domain Hosting
Web Hosting UK
Free Web space

E-Commerce Solution

Web Design Templates
New
Charity Web Hosting

TRANSFER Your Domain
Terms And Conditions

Contact Us
Articles
Asp Tutorial

 

 

Include File With ASP

ASP Server-Side Include File (SSI File)

A server-side include file is a good way to write code once, which will be repeated over several Web pages, such as making a uniform header. The include file can contain HTML, and both client-side or server-side scripts, and images, and will have the extension of either .inc or .asp. (If using ASP code in the SSI file, the SSI file will have to use the .asp extension. If not using the ASP code in the SSI file, either extension is fine.) The include file is stored outside of the Web pages but will be called from any Web page having the .asp extension. If you store the SSI file in a folder just for your SSI files, be sure to use the relative path (url) when calling it from a Web page situated in a different folder:
<!--#include file="../includes/filename.asp" -->

Use code to call the include file, where you want it used in the page; from within a table, a header, a footer area, etc. More than one server-side include (SSI file) may be called from an ASP page.

To call the SSI file, use this code:
<!--#include file = "filename.ext" -->
where filename is the name of your server-side include file and ext is either .inc or .asp, for the extension.

Here is an example of an include file:

<% @language = "vbscript" %>
<%<A Href='link1.html'>Link 1</A>&nbsp;<A Href='link2.html'>Link 2 </A>&nbsp;<A Href='link3.html'>Link 3</A>&nbsp;%>


An include file such as this one (above), might have a name such a top.asp, since server-side script is in the include file. This SSI file would be called first from every page in your Web site and the code would not have to be repeated for each individual page; but merely coded once for all of the pages.
The SSI file is not used as a technique to hide code from the user. Any code in the include file is sent to the browser (except the ASP code) and may be seen by the user. In the case of the ASP code, only the results of the ASP go to the browser, not the ASP code itself.

You will be able to think of places in your own Web site where your are using repetitive code on each page, such as in a navigation bar, and other places. This is where you will want to write server-side include files (commonly called SSI files) and just call the file each time it is placed on your page.
An example of calling the SSI file from a table:

<table width ="600" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td>
<img src="logo.gif">
</td>
<td>
<!--#include file="top.asp"-->
</td></tr></table>

In this example, you can see that you would have to code the table each time the include file is called. Instead of repetively coding the table, just include the entire table right in the SSI file so that the table code is not repeated on each page. The benefit of having tables inside the SSI file is that you only have to redesign a table once, to have it appear site-wide. This will save consider time on site maintenance. If a logo is in the header of your Web page, you can change the logo in the SSI file without having to change any other code on your Web site.
In summary, SSI files cannot be used on pages having an htm or html extension. Only use these SSI files on pages having a .asp extension. SSI files are used to prevent repetitive code, to save time, and to increase ease of site maintenance.

TIP: Avoid using .inc as filename e.g. 'top.inc' as this will enable people to download your include file. Using top.asp for example will ensure that the file is not downloaded.

TIP: Have many small include files instead of one large one and only include the relevant include files, this will ensure faster download of pages.

 

Stacks of web space and bandwidth with all packages

Dare to compare, checkout our competition!!

ASP Hosting £6/Year


.net hosting

.NET Hosting £10/Year
400MB

 

 

 

 

 

 

 

 

 

 

Uk's number one host for ASP Hosting