Click to See Complete Forum and Search --> : Dynamic include file in ASP
dvst8
May 29th, 2000, 10:02 PM
I want to let my users paste in some text as an include file for their page.
When I then display their page I want to include this file.
If I were to include a static include file the HTML would be:
<!--#include virtual=".../filename.inc" -->
but I want to dynamically specify this filename with some ASP, something like:
<!-- #include virtual=".../include_<%=firstname>_<%=lastname%>.inc" -->
Problem is, the ASP does not get processed because it is encased in a comment.
I have not been able to think of a workaround...
suggestions?
tx
Mark Sreeves
May 29th, 2000, 10:18 PM
How about:
<%
dim quote
quote = chr(34)
Response.Write "<!-- #include virtual=" & quote & ".../include_" & firstname & "_" & lastname & ".inc" & quote & "-->"
%>
dvst8
May 29th, 2000, 10:29 PM
good call mark.
i feel dumb..shoulda thought of that!!
thanx
Mark Sreeves
May 29th, 2000, 10:33 PM
No worries!
It somtimes helps to be removed from a problem to see it more clearly.
Does that make sense?
I've got a day off tomorrow so you'll be by yourself until Thursday! :):):):):):):):)
dvst8
May 30th, 2000, 12:12 AM
i'll try to manage :)
dvst8
May 30th, 2000, 02:55 AM
hey mark..
i tried it out, and it didn't work...
I have the following (ugly--but correct) statement in my ASP
<%
Response.Write "<!-- #include virtual="&chr(34)&"/EmployeeHomepages/"&fn&"_"&ln&"/include_"&fn&"_"&ln&".inc"&chr(34)&" -->"
%>
But when the page loads, I see the following statement in the source:
<!-- #include virtual="/EmployeeHomepages/testxy_case/include_testxy_case.inc" -->
It's not a good sign that I see this in the source--it should be the stuff in the file!
HOWEVER, when I paste the statement given above (in the second code block) as static html it works fine.
I think the problem here has to do with when the html it produced by the server....
I don't know how to get around this.... ideas?
tx
dvst8
May 30th, 2000, 03:33 AM
found a solution:
http://www.activeserverpages.com/learn/includedynamic.asp
it works!!!
I don't understand why though....
If someone looks at it and understands it, could you maybe tell me what's going on.
tx
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.