Print Page | Close Window

include file question

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=3118
Printed Date: 29 March 2026 at 10:15am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: include file question
Posted By: Scotty32
Subject: include file question
Date Posted: 29 May 2003 at 11:29am

hello

id like to be able to include a file so i can use one page for my site

ie "default.asp?page=home"

and then i want to include the file that stores the "home" content in

but i oviously cant use <!--#include file="<%=page%>"-->

but when i tried the "server.request( page )" it didnt process the ASP in it

is there a way i can do this without having to do

if page = "home" then

    <!--#include file="home.inc"-->

end if

if page = "about" then

    <!--#include file="about.inc"-->

end if

?????

 

(PS i dont think "server.request()" is right, becose i cant remember wot it is, but i did use the right code, becose i copied it straight from a post MadDog made )




Replies:
Posted By: michael
Date Posted: 29 May 2003 at 12:15pm
It is not possible. If you do a search on this forum you will get tons of posts talking about that. In a Nutshell, Includes are SSI not ASP so get processed before any ASP code. There are no real dynamic includes on asp, you can use server.execute or server.transfer but that is about it.

-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: Scotty32
Date Posted: 30 May 2003 at 9:52am

yeah i think it was "Server.Execute" wot i acctually used...

that cant process the ASP in the include though can it?



Posted By: michael
Date Posted: 30 May 2003 at 10:40am
Not sure what you mean but server.execute can process any asp as all it does is executing a page being called from the originator.

-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: Scotty32
Date Posted: 30 May 2003 at 10:47am

well say i have a page called

"usercheck.asp"

and its like

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

<%

if userlevel = "1 then
   sumfin = "this"
else
   sumfin = "that"
end if

%>

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

then i have another that does

<% server.execute("usercheck.asp") %>

will it process the ASP from the "usercheck.asp"

cose am sure i got errors when i did it?

BTW, i'll need to use the FileSystem Object, and access databases with the included files

i need the "asp" include and not SSI becose i wanna be able to choose wot to include like

<%
     page = "default.asp"

     Server.Execute( page )
%>



Posted By: MorningZ
Date Posted: 30 May 2003 at 10:58am

just do the if..then...else statements with the includes...

i mean you have already wasted a few days trying to do "sumfin" you don't understand....

just use what works



-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: Scotty32
Date Posted: 30 May 2003 at 11:00am

yeah but am tryna find an easyer way of doing wot am tryna do

am currenly usin the

"case" thing

but am thinkin this will be easyer to have, if i wanna add pages

(PS leave my "slang" alone, i listen to rap!)

*edit*

ooh, btw, do you have to have that kinda attitude?

you've had ago at me b4, for ma slang.... mate, this is the internet, slang is all ova the place

and as for me "wasting" 3 days.....
like i said, am only tryna find a better way of doing this!

so how have i wasted 3 days?

if anyfin i wasted time, readin your post!

and i know this is a "ASP Discussion" but if ya read the posts, its mostly people askin for help with there ASP Scripts, and people "helping" others wit there problems, so wanna try an help next time? cose i dont think ya post was much help

and back ta tha slang... wots wrong with me usin slang, do you tell people with poor english to talk better?

just cose you know alot of ASP dont mean we all do, sum of us are tryna learn, like you did one day, so give us a break

(PS yeah i know ya aint allowed to "Flame" but come on! do i gotta take this?)



Posted By: fernan82
Date Posted: 30 May 2003 at 1:10pm

Server.Execute will execute the ASP code on usercheck.asp but it won't be able to interact with the code on the page you're calling it from...

you can include the same asp file in the same page using server.execute as many times as you want with the same variables and it won't interfere with each other...

so server.execute won't do what you're trying to do cuz you can't use the variables from the included file in the file where you called it from  ...basicaly with server.execute it'll look like the included file is on the same page but really is running on a different background as if it where on another window......



-------------
FeRnAN
http://www.danasoft.com/">



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net