// page information $page_type = "t"; $page_title = "ASP Includes"; $page_keywords = "asp, asp tutorials, asp scripts, asp tips, includes, asp includes"; $page_description = "ASP includes tutorial. Find more tutorials and scripts at TheScripts.com, a programming and software development resource, directory and community."; $page_articletitle = "ASP Includes"; $page_next_url = "/serversidescripting/asp/articles/page1.html"; $page_next_anchor = "ASP Cookies"; $page_prev_url = ""; $page_prev_anchor = ""; $page_author = "Robert Murdock"; $page_byline = "Programmer, Darpac Inc."; // site header include ($_SERVER["DOCUMENT_ROOT"]."/header.php"); // begin html ?>
ASP Includes
As you start creating scripts you will find that there are sections of code that you keep using over and over. Start keeping these in include file. With an include you will be able to just put one line in your new script and use a function or piece of code with out having to cut and paste or re-write it.
File: incdemo.inc
<%
somevar = "This was defined in the include. We use it over
and over<BR>"
Function somefunc()
Response.Write "This is called from a function in the
include.<BR>"
End Function
%>This is the file that you would actually allow users to execute.
File: incdemo.asp
<!--#include file="incdemo.inc"-->
<%
Response.Write somevar
somefunc()
%>