Home | Advertising Info47 USERS CURRENTLY ONLINE   
PowerASP
   Site Search Contact Us Wednesday, May 01, 2024  

  Active InfoActive Info  Display List of Info MembersMemberlist  Search The InfoSearch  HelpHelp
  RegisterRegister  LoginLogin
Classic ASP - Code Samples
 PowerASP Code Help Area : Classic ASP - Code Samples
Subject Info: Include Example A d d  -  P o s tAdd P o s t
Author
Message << Prev Info | Next Info >>
cwilliams
Admin Group
Admin Group
Avatar

Joined: April/26/2004
Location: United States
Online Status: Offline
Info: 137
Added: April/27/2004 at 8:13pm | IP Logged Quote cwilliams

Include Example

Server-side includes give you a way to insert the content of another file into a file before the server processes it. ASP implements only the #include directive of this mechanism. To insert a file into an .asp file, Use the following syntax:

<!--#include file = "myfile.asp"-->
This would include a file in the same directory of the asp script that contains this statement. You can also use things like "../somedirectory/somefile.asp" and "somedirectory/somefile.asp" to specify the location of the file.

<!--#include virtual = "/somedirectory/somefile.asp"-->

This would include a file on your site located virtually.

However since includes are inserted before the server processes the ASP you cannot use an asp variable to dynamically change the file being included.

You could have a series of (if/else) statements with different Includes within each one.

Example:

<% if bla = "1" then %>
<!--#include file="file1.asp"-->

<% elseif bla = "2" then %>
<!--#include file="file2.asp"-->
<% end if %>


You could also include another asp file and then have that file perform the tests neccessary to determine the page to be directed to.

Example:

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

And the contents of determinefile.asp would be.

<% if bla = "1" then %>
<% response.write("file1.asp") %>
<% elseif bla = "2" then %>
<% response.write("file2.asp") %>
<% end if %>



__________________


Chris Williams
http://www.PowerASP.com
Back to Top View cwilliams's Profile Search for other info by cwilliams
 

If you wish to make a comment to this info you must first login
If you are not already registered you must first register

  A d d  -  P o s tAdd P o s t
Printable version Printable version

Info Jump
You cannot add new info in this area
You cannot add to info in this area
You cannot delete your info in this area
You cannot edit your info in this area
You cannot create polls in this area
You cannot vote in polls in this area

   Active Server Pages Rule The World
Contact Us  
All artwork, design & content contained in this site are Copyright © 1998 - 2024 PowerASP.com and Christopher J. Williams
Banner ads ,other site logos, etc are copyright of their respective companies.
STATS Unless otherwise noted - All Rights Reserved.

Active Server Pages ASP programs help tutorial tutorials routine routines jobs listserve mailinglist bulletin board bulletin boards programming snippet snippets CJWSoft ASPProtect ASPBanner ASPClassifieds www.aspprotect.com, www.cjwsoft.com,www.aspclassifieds.com,www.aspphotogallery.com