Print Page | Close Window

Dynamic Incude

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=9682
Printed Date: 29 March 2026 at 8:03am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Dynamic Incude
Posted By: neotrix
Subject: Dynamic Incude
Date Posted: 10 February 2004 at 2:45am

Hi, I looked and some of the other threads, talking about the Dynamic Include in ASP, but they didn make it to any conclusion..

I am making something lyk Multiple skins for Web WIz Forums, I'm not working on a mod or something like that, any how, i want to dynamic include the navigation button inc file, i am gona work out about 100 Skins so i cannot use the "Case" thing, Server.Execute, Atleast with my server, works perfect, and even if i use Variables, it still executes it, but the problem is that my PWS dosent support this... and i need to test my work of 100 skins before i upload it, and upload is a big troubble for me, there are lots of files etc, but what i wana ask is

Can i make my PWS to be able to run the Server.Execute command ?

is there any way i can Dynamically Include a file ?

P.S I'm gona read the file name variable from the DB

Please Help!! I'm STUCK right in the middle of my site



-------------
http://www.muhammadbinyusrat.com/blog/" rel="nofollow - Say to the believing men..



Replies:
Posted By: Mart
Date Posted: 10 February 2004 at 5:05pm
The only way to do a dynamic include is Server.Execute variable. And it should work in PWS.


Posted By: Semikolon
Date Posted: 10 February 2004 at 5:36pm

its not possible to dymamically include a file with the #include statement, as thats preprocessing..

server.execute and server.transfer wont work the same way, as the variables in a executed page wont affect the executing page and vice versa..



Posted By: pmormr
Date Posted: 10 February 2004 at 7:26pm

so let's sum this topic up right now so there's no confusion...

THIS IS HOW YOU SOLVE THE DYNAMIC INCLUDE PROBLEM IN ASP!!! IF ANYONE ELSE ASKS THIS QUESTION I'M GOING TO EXPLODE!

Server.Execute("/folder/subfolder/" & myVariableContainingFileName)

 



-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: dpyers
Date Posted: 10 February 2004 at 8:00pm
Originally posted by pmormr pmormr wrote:

so let's sum this topic up right now so there's no confusion...

THIS IS HOW YOU SOLVE THE DYNAMIC INCLUDE PROBLEM IN ASP!!! IF ANYONE ELSE ASKS THIS QUESTION I'M GOING TO EXPLODE!

Server.Execute("/folder/subfolder/" & myVariableContainingFileName)

Do it on a webcam. Sell subscriptions

For coming up with this great little money maker, I get tto be the one who asks the question!



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

Lead me not into temptation... I know the short cut, follow me.


Posted By: Bunce
Date Posted: 11 February 2004 at 1:04am
Originally posted by pmormr pmormr wrote:

so let's sum this topic up right now so there's no confusion...

THIS IS HOW YOU SOLVE THE DYNAMIC INCLUDE PROBLEM IN ASP!!! IF ANYONE ELSE ASKS THIS QUESTION I'M GOING TO EXPLODE!

Server.Execute("/folder/subfolder/" & myVariableContainingFileName)

LMAO. In a way, I'm disappointed that I don't have as much time to spend around here these days, however when I see posts like these.. I'm relieved. 

The number of times I answered this particular question, and especially trying to convince other members that this was not possible (ie. MadDog who swore it was possible and even had an article about it on his site) makes you wonder!



-------------
There have been many, many posts made throughout the world...
This was one of them.


Posted By: neotrix
Date Posted: 11 February 2004 at 5:16am
Originally posted by pmormr pmormr wrote:

so let's sum this topic up right now so there's no confusion...

THIS IS HOW YOU SOLVE THE DYNAMIC INCLUDE PROBLEM IN ASP!!! IF ANYONE ELSE ASKS THIS QUESTION I'M GOING TO EXPLODE!

Server.Execute("/folder/subfolder/" & myVariableContainingFileName)

 

Server.Execute DOSE NOT work on PWS

I just wrote that above



-------------
http://www.muhammadbinyusrat.com/blog/" rel="nofollow - Say to the believing men..


Posted By: neotrix
Date Posted: 11 February 2004 at 5:19am
Originally posted by Bunce Bunce wrote:

Originally posted by pmormr pmormr wrote:

so let's sum this topic up right now so there's no confusion...

THIS IS HOW YOU SOLVE THE DYNAMIC INCLUDE PROBLEM IN ASP!!! IF ANYONE ELSE ASKS THIS QUESTION I'M GOING TO EXPLODE!

Server.Execute("/folder/subfolder/" & myVariableContainingFileName)

LMAO. In a way, I'm disappointed that I don't have as much time to spend around here these days, however when I see posts like these.. I'm relieved. 

The number of times I answered this particular question, and especially trying to convince other members that this was not possible (ie. MadDog who swore it was possible and even had an article about it on his site) makes you wonder!

Can u please read the question before you include it in the list of other 10,000 questions you answered



-------------
http://www.muhammadbinyusrat.com/blog/" rel="nofollow - Say to the believing men..


Posted By: Semikolon
Date Posted: 11 February 2004 at 9:17am

if you want to just include CONTENT then server.execute works fine..

if you want to include VARIABLES, CONSTANTS, SERVER OBJECTS, etc then server.execute wont work

Server.Execute and .Transfer works in a way like IFrames, just that its not iframes, if you understand

 

but one way you could do this is to use FSO and write some new lines when you add a new skin..



Posted By: neotrix
Date Posted: 11 February 2004 at 9:27am
What do you mean FSO

-------------
http://www.muhammadbinyusrat.com/blog/" rel="nofollow - Say to the believing men..


Posted By: neotrix
Date Posted: 11 February 2004 at 9:50am

This Is what i get when i try to run Server.Execute...

Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'Execute'

/apnakohat/default.asp, line 188



-------------
http://www.muhammadbinyusrat.com/blog/" rel="nofollow - Say to the believing men..


Posted By: Semikolon
Date Posted: 11 February 2004 at 9:52am

FSO = FileSystemObject

Server.CreateObject("Scripting.FileSystemObject")



Posted By: neotrix
Date Posted: 11 February 2004 at 9:55am
Originally posted by Semikolon Semikolon wrote:

Server.Execute and .Transfer works in a way like IFrames, just that its not iframes, if you understand

That's What i'm looking for, i Dont want to transfer any variable or something, just want to include the contents of that page



-------------
http://www.muhammadbinyusrat.com/blog/" rel="nofollow - Say to the believing men..


Posted By: Semikolon
Date Posted: 11 February 2004 at 10:06am

have you tried Server.Transfer? im not sure if that was added in PWS and IIS v4 or IIS v5..

 

whats your system specs?

i suggest you update your os to at least windows 2000..



Posted By: dpyers
Date Posted: 11 February 2004 at 8:09pm
Server execute runds the code on the invoked page then returns to the next line of code in the calling page. Server Transfer is like a redirect in that it sends you to the new page, and doesn't return to the calling page.

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

Lead me not into temptation... I know the short cut, follow me.


Posted By: neotrix
Date Posted: 12 February 2004 at 7:45am

Guys I Guess I Did It

<%
Dim FSO, inFile
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set inFile = FSO.OpenTextFile( Server.MapPath("message.asp") )
Response.Write inFile.ReadAll
inFile.Close
Set inFile = nothing
%>

if we replace the message.asp with a variable, it will show the name of the page that we have in that variable Cool Isent It

-Neotrix



-------------
http://www.muhammadbinyusrat.com/blog/" rel="nofollow - Say to the believing men..


Posted By: Sxar
Date Posted: 14 May 2004 at 2:51am

So is there anyway to Dynamically Include a File in ASP, That does include Constants Variables ect. As i read above that Server.Execute doesnt work!

Please Help?



Posted By: Phat
Date Posted: 14 May 2004 at 3:29am
Check out
http://planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=8649&lngWId=4 - http://planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeI d=8649&lngWId=4

for dynamic includes.


Posted By: dpyers
Date Posted: 14 May 2004 at 9:08am

A page called through server.execute has access to the Request object. Cookies, Application and Session variables, and any Form/Querystring variables passed to the page that contains the server.execute code is available to the called page.

I'd use session variable to pass info instead of the fso. The problem with writing variables to a specific file (not counting the file creation/io/deletion overhead) is that it can fall apart when you get multiple users with different variables writing to the same file. A session variable at least unique to a specific user.



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

Lead me not into temptation... I know the short cut, follow me.


Posted By: Sxar
Date Posted: 15 May 2004 at 9:50am

Thanks Phat

That website worked just the treat just what i wanted thanks again!




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