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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query string for an include file

Status
Not open for further replies.

crystalized

Programmer
Jul 10, 2000
390
CA
Sorry, since I am new I do not know much about the basics, and I am wondering if I can send a query string when I use an include file.<br><br>ie<br><br>&lt;!-- #include file=&quot;../General/heading.asp?title=My+Title&quot; --&gt;<br><br>and then in the heading.asp file I would like to print out<br>My Title so I tried<br><br>&lt;%=Request.QueryString(&quot;title&quot;)%&gt;<br><br>But I am getting the error that<br>Error Type:<br>Active Server Pages, ASP 0126 (0x80004005)<br>The include file '../General/incHeading.asp?title=My+Title' was not found.<br><br>I know it finds the file when I do not put the query string on the end of the file name in the include.<br><br>Am I just trying to do this completely wrong, or am I close to the right track.&nbsp;&nbsp;What I want to accomplish is a standard heading file (so I can change the heading for all my forms in one location).&nbsp;&nbsp;But in the heading each form has it's own title which I would like to pass to the heading file.<br><br>If I am on the wrong track would someone mind pointing me in the right direction.<br> <p>Crystal<br><a href=mailto:crystals@genesis.sk.ca>crystals@genesis.sk.ca</a><br><a href= > </a><br>--------------------------------------------------<br>
Experience is one thing you can't get for nothing.<br>
-Oscar Wilde<br>

 
Write a function in the header file that takes the title you wish to print as a parameter. Have the function print out html using response.write. Then include the file and call the function.
 
I actually arrived at a conclusion very similar to that just a couple of minutes ago.&nbsp;&nbsp;Thanks for taking the time to answer, especially since it is something that I should have thought of right away. <p>Crystal<br><a href=mailto:crystals@genesis.sk.ca>crystals@genesis.sk.ca</a><br><a href= > </a><br>--------------------------------------------------<br>
Experience is one thing you can't get for nothing.<br>
-Oscar Wilde<br>
 
could you plz tell me how to have include files that have querystings.

Thanks
 
I also want to ask the same question as taval; could someone give a code example of froggerIII's explanation?

Thanks much,
Ray
 
in say, stdheader.asp:

Sub Header(title)
'close the asp tag (i don't know if tektips will mess it up

'write whatever html you want to, or don't close the asp
'tag and use response.write


'open asp tag
response.write title
'close asp tag

'or i guess you could do <%=title%> instead of adding an
'extra open and close

'more html


'open asp tag
End Sub

'end of stdheader.asp

ok, then do:
<!--#include file=&quot;stdheader.asp&quot;-->

at the top of whatever html file you want, then call the function inside asp tags, passing in the title, like this:

Header &quot;The title of this page&quot;

sorry it looks kind of confusing, but i am afraid the tek tips html will butcher everything, so you'll have to wade through it :(
ray
rheindl@bju.edu

 
Thanks for that solution; that works really well!!! I didn't even think of just putting the whole include in a function, calling it and passing it variables!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top