|
-
May 11th, 2001, 05:12 AM
#1
Thread Starter
Frenzied Member
Including a file dynamically
I expect this has been asked 26.4 times already but...
I am passing a page name to an ASP in the request string. I want to then include it using <!-- #include file='filename' -->
(fName is the variable holding the page name)
if I do<%
response.write "<!-- #include file='" & fName & "' -->"%>
the include string gets written correctly but the page doesn't get included.
if I do
<!-- #include file='<%=fName%>'-->
it says can find file <%=fName%>
-
May 11th, 2001, 05:44 AM
#2
Fanatic Member
Try:
<!-- #include file='<%=Request.QueryString("fName")%>'-->
-
May 11th, 2001, 05:51 AM
#3
Thread Starter
Frenzied Member
Nope!
That doesn't work either 
thanks
-
May 11th, 2001, 06:03 AM
#4
Lively Member
why double quotes?
how come u using double quotes?
You are living a pacifist dream, and if you dreaming it means you sleeping and you should damn well wake up!
-
May 11th, 2001, 06:19 AM
#5
Black Cat
The include gets processed before the page gets sent to the ASP engine, that's why its not working. I did a quick search on some asp sites, but I didn't see an exact workaround to what you need. You could use includes in if statements outside of the asp tags, but that causes all includes to be inserted.
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
May 11th, 2001, 06:57 AM
#6
Thread Starter
Frenzied Member
I figured that was the problem.
What I've done now is include a seperate asp file with a select statment in to write out the correct include string
-
May 11th, 2001, 02:59 PM
#7
Good Ol' Platypus
Try including all files that you may need.
EDIT \/
..eh What? Oh, you've solved your problem.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
May 11th, 2001, 05:14 PM
#8
Lively Member
JoshT is right, 'includes' gets parsed before ASP. If you want true 'dynamic includes', you wouldn't even use the #include statement. You'd have to use the filesystem object, read the contents of a file, then spit it out. I've made a template using it that way. There's an article on www.asp101.com about this topic. Just search it on their site.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|