Include question (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


wizard_oz -> Include question (11/7/2006 7:44:14)

Hi everyone
I have a code in asp and I would like to call to the file with a certain variable for example
<%
	if choose=1 then
	%>
	<!-- #include file="../Template/FloorTemplate.asp"-->
	<%
	else
	%>
	<!-- #include file="../Template/SportTemplate.asp"-->
	<%
	end if
	%>

I would like to do <!-- #include file="../Template/FloorTemplate.asp?id=1"-->
but this is not working, How can I make it work?
Thanks, Elen




Spooky -> RE: Include question (11/7/2006 15:00:21)

This should work for you?

<%
	if choose=1 then
	%>
	<!-- #include virtual="/Template/FloorTemplate.asp?id=1"-->
	<%
	else
	%>
	<!-- #include virtual="/Template/SportTemplate.asp"-->
	<%
	end if
	%>




wizard_oz -> RE: Include question (11/8/2006 6:37:18)

Hi Spooky
Thanks for your reply. I tried this code but it keeps telling me that "The include file 'test.asp?id=1' was not found "
any idea?




Spooky -> RE: Include question (11/8/2006 13:28:26)

Can you explain a little further what you need to do? I was thinking of something else [&:]




wizard_oz -> RE: Include question (11/9/2006 5:11:15)

Ok, the first page is menu page with 2 item and every menu add an ASP file wuch include some commands for example this is my first code and it's working fine
<%
	choose=Request.QueryString("choose")
	Application("LogoSport")="SPORT"
	Application("LogoFloor")="FLOOR"
	id=1
%>
<body>
<table width="765" border="0" align="right" cellpadding="0" cellspacing="0">
  <tr>
	<td colspan="2">
	<%
	if choose=1 then
	%>
	<!-- #include file="../Template/FloorTemplate.asp"-->
	<%
	else
	%>
	<!-- #include file="../Template/SportTemplate.asp"-->
	<%
	end if
	%>
 </td> </tr>
	<tr><td width="645"> </td>
		<td width="120" height="700" bgcolor="#666666" valign="top" align="right"> 
		<font face='arial' size=6><p align=center>
	<%
	if choose=1 then
		Response.Write Application("LogoFloor")
	else
		Response.Write Application("LogoSport")
	end if
	%>
	</p></font>
		
		</td>
	</tr>
</table>

the lines:
<!-- #include file="../Template/FloorTemplate.asp"-->
<!-- #include file="../Template/SportTemplate.asp"-->
are the same the only diffrents between them is the query, if I could make a coomand line like that:
<!-- #include file="../Template/FloorTemplate.asp?id=1"--> it will solve my problem becuase now I need to add more items to the menu file which means I will have 4 item in the menu file

Thanks,Elen




Spooky -> RE: Include question (11/14/2006 14:25:57)

If the include files are the same (except the query) I would be coding them within the page and not using an include.
Then, the only difference would be the query.
With includes, both files are included (used or not) so it also saves resources if just the required code is changed




wizard_oz -> RE: Include question (11/15/2006 11:20:23)

Hi, the solution is good but I have a problem with that, Now I will need to change all my files.
With my idea I create one file and I call him with all the other file (10 files)
Do you have any other idea for me?




wizard_oz -> RE: Include question (11/20/2006 15:12:59)

anyone?




Spooky -> RE: Include question (11/20/2006 16:10:53)

Still not quite clear - if you have an include file such as
<!-- #include file="../Template/FloorTemplate.asp"-->

As you have already declared that id=1 prior to that include, then all code in that include can access "ID" as a variable?
Im not too sure what you mean when referring to the menu




wizard_oz -> RE: Include question (11/21/2006 5:05:03)

Ok, let's say I'm calling to the file like that
if choose=1 then
<!-- #include file="../Template/FloorTemplate.asp"-->
else
<!-- #include file="../Template/SportTemplate.asp"-->
end if

but those files are the same file. the only diffrents between them is the variable of the CATEGORY in the query and it look like this:
sql="select * from RightMenu where category=2 and ShowMenu=on order by Priority"
I would like to do:
sql="select * from RightMenu where category=" & id & " and ShowMenu=on order by Priority"

Elen




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
7.714844E-02