Jump to content

Include File Command


nuzerog

Recommended Posts

I used to have a page that ran in frames and currently I am trying to remove the frames and use tables instead. However in one cell of the table I want to be able to pull in another web page. Can I do this? In one instance I was able to use <!--#include file = "content.asp"-->However, when I tried to do this with a specific reference i got an error. i.e. <!--#include file = "content.asp?indexNumber=Cat02"-->I am assuming this failed because the function works before the ASP is processed. Is there a work around this in which I can pull a page like I listed above into a cell of a table?Thanks much for any help or advice.HKIM

Link to comment
Share on other sites

I used to have a page that ran in frames and currently I am trying to remove the frames and use tables instead. However in one cell of the table I want to be able to pull in another web page. Can I do this? In one instance I was able to use <!--#include file = "content.asp"-->However, when I tried to do this with a specific reference i got an error. i.e. <!--#include file = "content.asp?indexNumber=Cat02"-->I am assuming this failed because the function works before the ASP is processed. Is there a work around this in which I can pull a page like I listed above into a cell of a table?Thanks much for any help or advice.HKIM
Okay let me try to pull the question back. Is the following even a valid command? <!--#include file = "content.asp?indexNumber=Cat02"-->ThanksHKIM
Link to comment
Share on other sites

#include is a valid command, but you're including a local filesystem file, not a web file. Local filenames don't have a question mark after the extension with a bunch of other stuff after it. You're telling it to look for a file with the name "content.asp?indexNumber=Cat02", not "content.asp". You need to set a variable and then include the other file, which can read the variable value.

<%@LANGUAGE="Javascript"%><%var test = "some text";%><!--#include file="file2.asp"-->

Inside file2.asp, you can refer to the variable "test" which will have the value "some text".

Link to comment
Share on other sites

  • 2 weeks later...
#include is a valid command, but you're including a local filesystem file, not a web file. Local filenames don't have a question mark after the extension with a bunch of other stuff after it. You're telling it to look for a file with the name "content.asp?indexNumber=Cat02", not "content.asp". You need to set a variable and then include the other file, which can read the variable value.
<%@LANGUAGE="Javascript"%><%var test = "some text";%><!--#include file="file2.asp"-->

Inside file2.asp, you can refer to the variable "test" which will have the value "some text".

Cool thanks. I have another question. Say in my home page index.asp i have Dim Aa = 0<!--#include file="file1.asp"-->Then in file1.asp I have a piece of code that goes like this:a = 10<!--#include file="index.asp"-->What is going to happen if I do this? Is this kind of loop even possible?Thanks
Link to comment
Share on other sites

Sure it's *possible*, but your web server will eventually crash when it runs out memory because of all the includes. The server will do exactly what you tell it to, so if you have 2 files that include each other, the server will just sit there in a loop including the files and filling up memory. It might have a way to detect that situation and just quit also. I'm not sure what you're trying to accomplish with the includes, but keep in mind that once the execution moves out of the included file back to the parent file, values will stay the same. If you set a to 10 inside file1.asp, when it gets back to index.asp a will still be 10.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...