When you think ASP, think...
Recent Articles
All Articles
ASP.NET Articles [1.x] [2.0]
ASPFAQs.com
Message Board
Related Web Technologies
User Tips!
Coding Tips
Search

Sections:
Book Reviews
Sample Chapters
Commonly Asked Message Board Questions
Headlines from ASPWire.com
JavaScript Tutorials
MSDN Communities Hub
Official Docs
Security
Stump the SQL Guru!
Web Hosts
XML Info
Information:
Advertise
Feedback
Author an Article
Technology Jobs



















internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers
ASP ASP.NET ASP FAQs Message Board Feedback ASP Jobs
Print this page.

Software Developer / Programmer - Interview NOW!
Next Step Systems
US-IL-Des Plaines

Justtechjobs.com Post A Job | Post A Resume

Using Includes


One of the steps to writing more readable and maintainable code is to write code as modular as possible. When writing ASP there are often chunks of code which you find yourself reusing quite often. For example, you may reuse a footer or header or both on each of your webpages (4Guys makes extensive use of footers, headers, what's new pages, etc.)

Also you may have a set of client-side form validation functions written, or some server-side functions that you use often. Rather than cutting and pasting these functions into each ASP page that needs them, it is advised that you employ the use of server-side includes.

To use server side includes, outside of your ASP code (i.e., outside of the <% and %>), include the following line:

<!--#include file="somefile.asp"-->

This will include the file somefile.asp into your ASP page, as though it had all been typed in there by hand. (The above example assumes that somefile.asp is in the same directory as the ASP page which is calling it with the SSI.)

For a more detailed explanation of server side includes (with examples of include file and include virtual, check out Charles Carrol's Include Tutorial.

Happy Programming!

FAQ Table of Contents   Using Option Explicit Inserting Form Responses into Databases 


Windows Internet Technology | ASP.NET [1.x] [2.0] | ASPMessageboard.com | ASPFAQs.com | Advertise | Feedback | Author an Article

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers