Jump to content

#include help


phrancie
 Share

Recommended Posts

I looked through the http://www.w3schools.com/asp/asp_incfiles.asp tutorial and noticed that I can't do what I was doing in my code down in the Tips and Notes section. I'm hoping someone here might be able to help with what I'd like to do.I want to include a file based on the input received from the user. I'm doing this because I don't want to use frames in my website, I'd rather use tables. So, depending on the input I receive from the user, I'm going to include the file into a section of the table rather than opening the file in another frame. Here's my snippet of code:

ACTION = Request.QueryString("ACT")Select Case ACTION	Case "EDITA"	%><!--#INCLUDE FILE='editaccount.asp'--><%	Case "KB"  %><!--#INCLUDE FILE='RDKbase.asp'--><%	Case "NEWT"  %><!--#INCLUDE FILE='newticket.asp'--><%	Case "SEARCHT"	%><!--#INCLUDE FILE='searchtickets.asp'--><%	Case "LOPEN"	%><!--#INCLUDE FILE='opentickets.asp'--><%	Case "LCLOSED"	%><!--#INCLUDE FILE='closedtickets.asp'--><%	Case Else  	%><!--#INCLUDE FILE='body.asp'--><%End Select

Obviously, this doesn't work. Is there any way I could get it to work?Any help would be greatly appreciated.UPDATE: Actually, I got it to work just fine the way it is above in the CODE block. It seems there were a few other syntax errors in the files I was trying to link to since they were pre-existing, standalone files.-Phrancie

Link to comment
Share on other sites

Actually, it worked just fine the way I had it above. Its close to your example with the exception that I closed out the <% at the end of each line where you did not. Yes, it executes the code from each file but it only inserts the code into the source for the option chosen in the case statement. The only downside to the way I did it is that you can't use a <%@ Language=VBScript%> at the top of any of the files located in the case statement. If I wanted to call any of those files outside of the case statment as an independent page, that would fail.Thanks for the help though,-Phrancie

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...