Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherProgramming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old July 24th, 2004, 09:33 PM
mattz0r mattz0r is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 1 mattz0r User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Arrow ASP: Including dynamic content

Hey all,
I'm in a bit of a pickle!

I want to include an ASP file in an ASP file. The ASP file that's being included has a dynamic name dependent on a querystring variable.

ie the file being included would be request.querystring("content")+".asp"
I have a function that copies code from a file into a variable, and I can response write that, however it doesn’t execute the asp code, because it uses the virtual path (Server.MapPath):

3rd party code :

Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objText = objFSO.OpenTextFile(Server.MapPath(strIncludeFile) ) With this variable containing asp code, can I include that somehow in <% %> of the main asp file? – ie so it will get executed as well as use other variables in that main asp file?

Is there a way to include include code into an asp file then have that executed? Keeping in mind that included asp files’ names are generated from a querystring variable.

I hope I’m making sense here, and I would massively appreciate it if anyone could help this noob out!

Cheers,
Matt

Reply With Quote
  #2  
Old July 29th, 2004, 10:33 AM
selwonk's Avatar
selwonk selwonk is offline
Contributing User
ASP Free Frequenter (2500 - 2999 posts)
 
Join Date: Jun 2004
Posts: 2,942 selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 6 Days 9 h 49 m 28 sec
Reputation Power: 62
Hi

You can not fix ASP variables into the #INCLUDE statement as the #INCLUDE statement is processed before the script runs

MK

Reply With Quote
  #3  
Old August 23rd, 2004, 02:36 PM
b1p0lar b1p0lar is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Location: Minneapolis, MN
Posts: 4 b1p0lar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Use server.execute

I bashed my head against a wall for days trying to do this. I found that if you are using asp 3.0 you can use the server.execute function which will transfer controll to the included page, but you will not be able to use any data from the page you are including the file from.

You are probably past this problem already, but this may help others in the future.



Quote:
Originally Posted by mattz0r
Hey all,
I'm in a bit of a pickle!

I want to include an ASP file in an ASP file. The ASP file that's being included has a dynamic name dependent on a querystring variable.

ie the file being included would be request.querystring("content")+".asp"
I have a function that copies code from a file into a variable, and I can response write that, however it doesn’t execute the asp code, because it uses the virtual path (Server.MapPath):

3rd party code :

Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objText = objFSO.OpenTextFile(Server.MapPath(strIncludeFile) ) With this variable containing asp code, can I include that somehow in <% %> of the main asp file? – ie so it will get executed as well as use other variables in that main asp file?

Is there a way to include include code into an asp file then have that executed? Keeping in mind that included asp files’ names are generated from a querystring variable.

I hope I’m making sense here, and I would massively appreciate it if anyone could help this noob out!

Cheers,
Matt

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherProgramming Help > ASP: Including dynamic content


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway