Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Include HTML file. HELP!!!

Status
Not open for further replies.

Technos

Programmer
Mar 15, 2002
47
US

Hi,
I'm having problem with including HTML file. I want to include the html file which takes the location at run time.

Here is my code

Dim selectCat, myArray(count)

selectCat = Policy
myArray(count) = Policy1.htm

mylocation = "Employee\selectCat\myArray(count)"

Now I want to inclde this file as

<!-- #include file = &quot;Employee&quot; & &quot;\&quot; & selectCat & &quot;\&quot; myArray(count)-->

Employee folder is hard coded, selectCat is subfolder of Employee.

Where I'm Wrong? Please Help

Thanks.
 
If I remember correctly,
all include files are loaded BEFORE any asp code is evaluated, so the selectCat variable is not set...

hth,
[profile]

 
That is correct. INCLUDE is a &quot;compile-time&quot; comnmand. An ASP can be compiled once, cached in memory and then used many times before it is &quot;kicked&quot; out by more frequently used ASP pages. Generate Forms/Controls Resizing/Tabbing Class
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
One other point worth mentioning, though I could always be wrong. You will need to escape your ASP script to write that include, ie:
Dim selectCat, myArray(count)

selectCat = Policy
myArray(count) = Policy1.htm

mylocation = &quot;Employee\selectCat\myArray(count)&quot;

Now I want to inclde this file as
%>
<!-- #include file = &quot;Employee&quot; & &quot;\&quot; & selectCat & &quot;\&quot; myArray(count)-->
<%

And for the record, i have had no problem dynamically generating paths to include files, I cheat like that quite often.
 
If you are using ASP 3.0, then you may want to use the Server.Execute command rather than the old <!-- include... --> preprocessor directive.

See for more info. Einstein47
(Love is like PI - natural, irrational, endless, and very important.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top