Author |
Topic |
gor
Retired Admin
Netherlands
5511 Posts |
Posted - 10 March 2001 : 10:27:38
|
I know I have seen this mentioned before, but I never really realised that it was this "bad".
If you look at default.asp the inc_footer.asp file gets included 7 times and is ofcourse displayed only once.
Were do these 7 times come from ? inc_top.asp: 2 inc_functions.asp: 4 default.asp: 1
Though inc_footer.asp isn't the longest file there is, this means that it is included 6 times more than is really needed in almost every file, since most files use inc_top.asp and inc_functions.asp and include inc_footer.asp themselves. Even with 76 lines in inc_footer.asp that is much.
Fixing it is very easy too:
In inc_functions.asp add a sub: Sub WriteFooter() %> <!--#INCLUDE FILE="inc_footer.asp"--> <% end sub and then replace the include in all the other files and inc_functions.asp itself with: WriteFooter
Remember that you'll have to move it inside the asp code, so i.e. this: <!--#INCLUDE FILE="inc_footer.asp"--> <% end sub
should be replaced by: <% WriteFooter end sub
Pierre |
|
Reinsnitz
Snitz Forums Admin
USA
3545 Posts |
Posted - 12 March 2001 : 14:56:20
|
so literaly every single forum file has a minimum of 7 times... some even more.
Reinsnitz (Mike) ><)))'> Need a Mod? "Therefore go and make disciples of all nations,..." Matthew 28:19a |
|
|
gor
Retired Admin
Netherlands
5511 Posts |
Posted - 12 March 2001 : 15:14:41
|
Yes in the current version that is the case.
Pierre |
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 12 March 2001 : 15:30:58
|
take a look at post_info.asp
and since Go_Result already includes inc_footer.asp then each instance after the Go_Result and before Response.End can be eliminated. ( I remember seeing this mentioned before, but just noticed it again when I was adding Huw's Posting Restriction MOD just now). Huw removed the extra inc_footer.asp INCLUDES in the files he included in that MOD. (I was wondering why my line #'s weren't matching up. ) |
|
|
Reinsnitz
Snitz Forums Admin
USA
3545 Posts |
Posted - 12 March 2001 : 15:42:58
|
NOTE: For me.
Remember to rename inc_top.asp to inc_header.asp and inc_top_short.asp to inc_header_short.asp while doing this fix.
(just being more consistant with everything else... caus it's either this... or changing footer to bottom... and I don't think any of us want that
Reinsnitz (Mike) ><)))'> Need a Mod? "Therefore go and make disciples of all nations,..." Matthew 28:19a |
|
|
Doug G
Support Moderator
USA
6493 Posts |
|
gor
Retired Admin
Netherlands
5511 Posts |
Posted - 13 March 2001 : 00:52:22
|
ehm...the thingy Doug mentioned in the other topic: if we wrap inc_top.asp in a sub...would make the variables declared in there have procedure scope and not page scope. That would be a problem for my_Conn (being opened in inc_top.asp and inc_top_short.asp) and possibly mLev (which is being referred to througout the page).
A possible fix is to Dim both in config.asp and then just open them were they are now. That way they still have page scope.
Pierre |
|
|
Doug G
Support Moderator
USA
6493 Posts |
Posted - 13 March 2001 : 10:13:15
|
I only saw
dim mLev, strLoginStatus
in inc_top
====== Doug G ====== |
|
|
Reinsnitz
Snitz Forums Admin
USA
3545 Posts |
Posted - 13 March 2001 : 13:23:53
|
I thought that a sub actualy kinda just takes a segment of code and drops it in place where called.. variables included.
Reinsnitz (Mike) ><)))'> Need a Mod? "Therefore go and make disciples of all nations,..." Matthew 28:19a |
|
|
davemaxwell
Access 2000 Support Moderator
USA
3020 Posts |
Posted - 13 March 2001 : 13:34:51
|
quote:
I thought that a sub actualy kinda just takes a segment of code and drops it in place where called.. variables included.
But if a variable is declared in a sub, it's only good in that sub. It's not global....
Dave Maxwell -------------- Proud to be a "World Class" Knucklehead |
|
|
Reinsnitz
Snitz Forums Admin
USA
3545 Posts |
Posted - 13 March 2001 : 15:00:50
|
I realy must be bad off... a world class knucklehead just told me!
Reinsnitz (Mike) ><)))'> Need a Mod? "Therefore go and make disciples of all nations,..." Matthew 28:19a |
|
|
Doug G
Support Moderator
USA
6493 Posts |
Posted - 13 March 2001 : 15:11:19
|
Hey, it's "World Class", not just plain vanilla World Class
====== Doug G ====== |
|
|
Reinsnitz
Snitz Forums Admin
USA
3545 Posts |
Posted - 13 March 2001 : 15:16:08
|
ah man... there I go again!
Reinsnitz (Mike) ><)))'> Need a Mod? "Therefore go and make disciples of all nations,..." Matthew 28:19a |
|
|
Doug G
Support Moderator
USA
6493 Posts |
Posted - 13 March 2001 : 17:40:43
|
====== Doug G ====== |
|
|
work mule
Senior Member
USA
1358 Posts |
Posted - 15 March 2001 : 09:27:55
|
quote:
quote:
I thought that a sub actualy kinda just takes a segment of code and drops it in place where called.. variables included.
But if a variable is declared in a sub, it's only good in that sub. It's not global....
Dave's right. A variable that is dim'ed in a sub or function are local to that sub/function. A variable dim'ed outside of the sub or function can be modified by a sub or function.
One option is to put inc_top's vars at the top of the file and then wrap everything else in a sub. When that file is included, the dim statements will be outside of the sub and thus be global to the page. Then when you need to display or use the inc_top code, just call the sub/function. Does this make sense?
|
|
|
work mule
Senior Member
USA
1358 Posts |
Posted - 15 March 2001 : 09:38:26
|
...now back to the original topic about multiple includes of inc_footer.
Here's the current status of 3.2a06 code:
Searching for inc_footer.asp - Found 90 occurrence(s) in 36 file(s)
Included the instances of duplicate references
admin_login.asp(83) admin_login.asp(119)
inc_functions.asp(1686) inc_functions.asp(1700) inc_functions.asp(1726) inc_functions.asp(1740)
inc_top.asp(154) inc_top.asp(172)
pop_profile.asp(55) pop_profile.asp(1196)
post.asp(317) post.asp(1105)
post_info.asp(58) post_info.asp(66) post_info.asp(78) post_info.asp(133) post_info.asp(152) post_info.asp(158) post_info.asp(187) post_info.asp(195) post_info.asp(207) post_info.asp(359) post_info.asp(405) post_info.asp(419) post_info.asp(426) post_info.asp(493) post_info.asp(521) post_info.asp(535) post_info.asp(605) post_info.asp(626) post_info.asp(640) post_info.asp(648) post_info.asp(661) post_info.asp(710) post_info.asp(745) post_info.asp(753) post_info.asp(765) post_info.asp(819) post_info.asp(855) post_info.asp(863) post_info.asp(875) post_info.asp(937) post_info.asp(973) post_info.asp(981) post_info.asp(993) post_info.asp(1034) post_info.asp(1070) post_info.asp(1078) post_info.asp(1090) post_info.asp(1110) post_info.asp(1142) post_info.asp(1150) post_info.asp(1163) post_info.asp(1183) post_info.asp(1209) post_info.asp(1415) post_info.asp(1426)
register.asp(65) register.asp(340) register.asp(352) register.asp(378)
As was stated earlier, post_info.asp is the worst offender.
This was previously mentioned in this topic: http://forum.snitz.com/forum/link.asp?TOPIC_ID=4354
|
|
|
Topic |
|