Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 IF - THEN or "Select Case" HELP
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Lycaster
New Member

USA
60 Posts

Posted - 02 May 2001 :  07:58:34  Show Profile  Visit Lycaster's Homepage  Send Lycaster an AOL message

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  Show Profile  Visit HuwR's Homepage
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.

Go to Top of Page

mafifi
Junior Member

USA
308 Posts

Posted - 02 May 2001 :  19:19:11  Show Profile  Send mafifi an ICQ Message
<%
Select Case pickFile
Case 1: %>
<!--#include file="1.asp"-->
<% Case 2: %>
<!--#include file="2.asp"-->
<% Case 3: %>
<!--#include file="3.asp"-->
<% End Select %>





Mo
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 02 May 2001 :  19:24:30  Show Profile  Visit HuwR's Homepage
this still loads ALL the include files when the asp is parsed, it does NOT conditionally include them

Go to Top of Page

PJamieson
Starting Member

United Kingdom
11 Posts

Posted - 03 May 2001 :  02:36:31  Show Profile  Visit PJamieson's Homepage
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.

Go to Top of Page

work mule
Senior Member

USA
1358 Posts

Posted - 03 May 2001 :  09:56:00  Show Profile
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.

Go to Top of Page

work mule
Senior Member

USA
1358 Posts

Posted - 03 May 2001 :  10:01:09  Show Profile
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?

Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 03 May 2001 :  13:07:57  Show Profile
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
======
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.41 seconds. Powered By: Snitz Forums 2000 Version 3.4.07