Author |
Topic |
|
Lycaster
New Member
USA
60 Posts |
Posted - 02 May 2001 : 07:58:34
|
I need some help, I am trying to load specific include files only when requested. For example:
display.asp?Section=Media
will call this code in display.asp:
<% If Request("Section") = "Media" Then %> <!-- #include file="Superstitial/Media/content.asp" --> <% End If %>
Now I have allot of these "Requests" in a list one after the other. For some reason my site is EXTREMELY slow. My guess is every one of my 40 or so include files are being loaded every time a request is made. How do I set up where only the include files that are needed for that section are loaded?
Do I need to use "Select Case" and if so, How?
Thanks for the help.
- Jared
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 02 May 2001 : 08:04:33
|
Your guess is sort of correct, however using a case statement will not help, ALL the include files are loaded and parsed by the ASP engine, even though they are not presented to the browser, there is no way round this.
|
|
|
mafifi
Junior Member
USA
308 Posts |
Posted - 02 May 2001 : 19:19:11
|
<% Select Case pickFile Case 1: %> <!--#include file="1.asp"--> <% Case 2: %> <!--#include file="2.asp"--> <% Case 3: %> <!--#include file="3.asp"--> <% End Select %>
Mo |
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 02 May 2001 : 19:24:30
|
this still loads ALL the include files when the asp is parsed, it does NOT conditionally include them
|
|
|
PJamieson
Starting Member
United Kingdom
11 Posts |
Posted - 03 May 2001 : 02:36:31
|
Yep, the server loads all Javascript first, then the include files (you can prove this by declaring the same variable in two different include files and watch the error).
If you are using IIS5 you could use server.execute to load a page ONLY when you need it e.g.
<% Select Case pickFile Case 1: server.execute "1.asp" Case 2: server.execute "2.asp" End Select %>
This is much more efficient.
|
|
|
work mule
Senior Member
USA
1358 Posts |
Posted - 03 May 2001 : 09:56:00
|
quote:
Yep, the server loads all Javascript first, then the include files (you can prove this by declaring the same variable in two different include files and watch the error).
Actually, how I understand it, the server processes all include declarations first and then the ASP code.
quote:
If you are using IIS5 you could use server.execute to load a page ONLY when you need it e.g.
This is much more efficient.
Maybe more efficient than having multiple include files, but an include is still more efficient than server.execute. I've read that you do take a hit on server.execute. The advantage w/ an include is that the server caches the includes w/ the asp file, whereas server.execute has to be processed each time.
|
|
|
work mule
Senior Member
USA
1358 Posts |
Posted - 03 May 2001 : 10:01:09
|
quote:
My guess is every one of my 40 or so include files are being loaded every time a request is made.
Don't take this the wrong way, but if you have 40 include files, you may want to step back and review what you're trying to do. What do these include files contain?
|
|
|
Doug G
Support Moderator
USA
6493 Posts |
Posted - 03 May 2001 : 13:07:57
|
quote:
Maybe more efficient than having multiple include files, but an include is still more efficient than server.execute. I've read that you do take a hit on server.execute. The advantage w/ an include is that the server caches the includes w/ the asp file, whereas server.execute has to be processed each time.
This can also be a disadvantage. Intemperate use of include files can eat up server memory in a hurry. There is an interesting article on the subject at http://www.asptoday.com/content/articles/19991207.asp?WROXEMPTOKEN=2572769Z4vq1facefRVnxjpVnB (except I can't read it anymore!)
====== Doug G ====== |
|
|
|
Topic |
|