RE: ASP and Includes

by Chuck Evans <Chucke(at)captura.com>

 Date:  Wed, 13 Dec 2000 15:10:26 -0800
 To:  "HWG Languages (E-mail)" <hwg-languages(at)hwg.org>
  todo: View Thread, Original
I answered my own question like this:

<% insertfile="/includes" & base_language & "/common/copyright.html"
   Call ReadDisplayFile(insertfile) %>

I found this solution (and reworked it a bit) at:
http://www.learnasp.com/learn/includedynamic.asp

This works for "included" files that do not have variables in themselves.
However, I have some included files that have the base_language variable in
them, and I still want to keep them. But now that I think about it, I can
use relative paths in those docs. Hmmm.

-----Original Message-----
From: Chuck Evans 

I want to be able to set a variable at the top of an ASP page that will work
as part of a path name in include statements used in the same ASP page. In
other words, set the language variable to "/en" and then have all the
English language include files used on that page.

This is what I tried:

1. At the top of the ASP page, I defined a variable: 

   <% base_language = "/en" %>

2. Then I used include statements like:

   <!--#include virtual="<%= base_language %>/header.inc"-->

The trouble is that ASP seems to process all the include statements first,
then remaining ASP stuff. So I get an error that the server can't find the
path with "<% etc %>" in it.

I tried using Response.Write to write the include statements but that also
did not work.

Any help?

Chuck Evans 
Captura, Inc. 
(425) 803-8355 
http://www.captura.com

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA

This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.