Home > Archive > ASP > June 2005 > Include file with param
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Include file with param
|
|
|
| Hi,
I try to accomplish something like this:
<!--#include file="menu_<%response.write (strproduct)%>.html"-->
But unfortunally, I quess there is something with my syntax... any idea ?
| |
| Adrienne 2005-06-09, 8:55 am |
| Gazing into my crystal ball I observed "TNG" <TNg@group.com> writing in
news:SUQpe.114741$x46.6802546@phobos.telenet-ops.be:
> Hi,
>
> I try to accomplish something like this:
>
><!--#include file="menu_<%response.write (strproduct)%>.html"-->
>
> But unfortunally, I quess there is something with my syntax... any idea
> ?
>
The include is processed before ASP code is processed, and therefore does
not have access to any variables.
What you might want to do is something like:
<% select case request.querystring("page")
case "apples"%>
<!--#include file="menu_apples.html"-->
<% case "oranges"%>
<!--#include file="menu_oranges.html"-->
<% case else%>
<!--#include file="menu_default.html"-->
<% end select%>
--
Adrienne Boswell
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
| |
| Roland Hall 2005-06-09, 8:55 am |
| "TNG" wrote in message
news:SUQpe.114741$x46.6802546@phobos.telenet-ops.be...
: I try to accomplish something like this:
:
: <!--#include file="menu_<%response.write (strproduct)%>.html"-->
:
: But unfortunally, I quess there is something with my syntax... any idea ?
The include file executes for the ASP processor. The only way I know to use
an include file dynamically is to use server.execute.
I have an example:
Run this alone and it will report it's virtual path:
http://kiddanger.com/lab/serverdotexec.asp
Run it with ?q=a, ?q=b or ?q=c and it will also include the appropriate
file.
Here's the code:
<%@ Language=VBScript %>
<%
Option Explicit
Response.Buffer = True
dim q
q =
server. HTMLEncode(replace(replace(replace(Reque
st.QueryString("q"),"'","''"),";",""),"--",""))
Response.Write Request.ServerVariables("SCRIPT_NAME") & "<br />" & vbCrLf
if q <> "" Then
select case q
case "a"
server.execute "/lab/serverdotexeca.asp"
case "b"
server.execute "/lab/serverdotexecb.asp"
case "c"
server.execute "/lab/serverdotexecc.asp"
case else
Response.Write "Nice try!"
Response.End
end select
end if
%>
This is serverdotexeca.asp. b and c are similar.
<%@ Language=VBScript %>
<%
Option Explicit
Response.Buffer = True
Response.Write "This is serverdotexeca.asp<br />" & vbCrLf
%>
HTH...
--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
| |
|
| Thx
"Adrienne" <arbpen2003@sbcglobal.net> wrote in message
news:Xns966FEE71D3275arbpenyahoocom@207.115.63.158...
> Gazing into my crystal ball I observed "TNG" <TNg@group.com> writing in
> news:SUQpe.114741$x46.6802546@phobos.telenet-ops.be:
>
>
> The include is processed before ASP code is processed, and therefore does
> not have access to any variables.
>
> What you might want to do is something like:
>
> <% select case request.querystring("page")
> case "apples"%>
> <!--#include file="menu_apples.html"-->
> <% case "oranges"%>
> <!--#include file="menu_oranges.html"-->
> <% case else%>
> <!--#include file="menu_default.html"-->
> <% end select%>
>
> --
> Adrienne Boswell
> http://www.cavalcade-of-coding.info
> Please respond to the group so others can share
|
|
|
|
|