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

Querystring to determine is file is included? 1

Status
Not open for further replies.

ca8msm

Programmer
May 9, 2002
11,327
GB
I want to include a header file on one of my pages depending on the result of a query string. i.e.

Code:
<%
if request.querystring(&quot;Test&quot;)=&quot;1&quot; then
response.write &quot;<!-- #include file=&quot;&quot;../includes/header.asp&quot;&quot;-->&quot;
end if
%>
[code]

This header file is basically a menu that will be hidden depending on a set number of arguments which in turn will set the querystring to 0 or 1.

If I set the querystring as 0 and do
[code]
response.write request.querystring(&quot;Test&quot;)
then i get 0 as expected and I get 1 if I set it as one. All fine so far...

If I view the source of the document when it is 1 the include is there and it isn't if it is 0....Still fine...

Only problem is the menu is not actually displayed. If I do away with the if statement and just include the file regardless of the querystring then the menu is displayed. Is there a reason why I would not be able to only include a file depending on this querystring?

----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
Hi,

include files cannot be dynamically included due to processing sequence. In other words the files are &quot;included&quot; before any programming decision is ever made.

Try using Server.Execute instead.

hope this helps,

Falcon
 
<% if request.querystring(&quot;Test&quot;)=&quot;1&quot; then %>
<!-- #include file=&quot;&quot;../includes/header.asp&quot;&quot;-->
<% end if %>
 
Thanks Falcon99

----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top