Forums

ASP

This topic is locked

Server Side Includes?

Posted 21 May 2004 18:07:46
1
has voted
21 May 2004 18:07:46 Greg LeBreck posted:
I am toying with SSI in ASP.
Question is can I store them in a seperate directory. i.e. a folder called includes? And will they be available to the whole site, even sub directories?

Replies

Replied 21 May 2004 18:20:48
21 May 2004 18:20:48 Dave Thomas replied:
yes, you can put them wherever you want, as long as the file it is included in can reference the path to it properly, your laughing.

to have them available to the whole site, inc subdirectories, i usually keep my folder structure to 1 level, all browser viewable pages in one place, so all files can use the same referenceto the include.

other than that, if i have to have lots of sub-directories, i usually copy the includes folder into the root of each folder, and include it from there.

lots of ways to do it, and lots of ways not to do it.

oh and best to use an .asp extension on the include file rather than the standard .inc tag.

Regards,
Dave

[DWMX 2004]|[FlashMX 2004 Pro]|[Studio MX 2004]|[SQL]|[Access2000/2002]|[ASP/VBScript]|[XP-Pro]
If you like online gaming, please register @ www.nova-multigaming.com
Replied 21 May 2004 18:26:52
21 May 2004 18:26:52 Greg LeBreck replied:
Thats's what I wanted to know! Thanks for the quick reply!
Replied 21 May 2004 18:31:25
21 May 2004 18:31:25 Vince Baker replied:
Just to add to Dave's comments, there are two types of includes, files and virtual.

A Virtual Include must have the full path specified i.e. /inc/filename.asp whereas a file include is in relation to the document i.e. ../../inc/filename.asp

Regards
Vince

DMX Talkzone Manager

Visit my home: www.chez-vince.com

VBScript | ASP | HTML | SQL | Oracle | Hosting
Replied 21 May 2004 18:49:22
21 May 2004 18:49:22 Greg LeBreck replied:
So what your saying is if I use a virtual include I can put it anywhere?
Eample:
Include: inc/include.asp
File it's in: /admin/index.asp
So the path to the virtual would be ../inc/include.asp

Am I saying this right?
Replied 21 May 2004 18:57:12
21 May 2004 18:57:12 Dave Thomas replied:
Yes

just the difference is a file include is:
<pre id=code><font face=courier size=2 id=code><font color=red>&lt;!-- #include file="inc/include.asp" --&gt; </font id=red></font id=code></pre id=code>

and the virtual is:
<pre id=code><font face=courier size=2 id=code><font color=red>&lt;!-- #include virtual="../inc/include.asp" --&gt; </font id=red></font id=code></pre id=code>

Regards,
Dave

[DWMX 2004]|[FlashMX 2004 Pro]|[Studio MX 2004]|[SQL]|[Access2000/2002]|[ASP/VBScript]|[XP-Pro]
If you like online gaming, please register @ www.nova-multigaming.com
Replied 21 May 2004 19:02:17
21 May 2004 19:02:17 Greg LeBreck replied:
Sweet! The virtual is what I will want to do so I can include it in any file in any directory.

Are there any cons to using this?
Replied 22 May 2004 01:42:02
22 May 2004 01:42:02 Vince Baker replied:
None at all, I always use virtual includes as the page that is displaying the include could be in any location on the site.

Regards
Vince

DMX Talkzone Manager

Visit my home: www.chez-vince.com

VBScript | ASP | HTML | SQL | Oracle | Hosting
Replied 22 May 2004 16:02:39
22 May 2004 16:02:39 Phil Shevlin replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Are there any cons to using this?
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Be careful if you ever plan to move to a win2k3 server. Most host do not allow "Parent Paths". This will break all your virtual includes. It has proven to be a pain in my a$$ with all the pure upload extensions.
Replied 25 Mar 2006 01:10:49
25 Mar 2006 01:10:49 David Soros replied:
Server 2003 doesn't not allow for -#include file which is generated on each asp page in MX. I was told I must use -#include virtual now. The problem is once I change an asp page to this new "include virtual" I can not view it (I'm running XP Pro) locally, but when I upload it (server 2003) everything works fine now. How can I run "include virtual" locally? Also is there a way to get each page to change the include statement to #include virtual without going into each and every page?
Thanks
Replied 25 Mar 2006 05:33:21
25 Mar 2006 05:33:21 Javier Castro replied:
I have tested includes on a Win 2003 Server and to test my various sites I have adjusted my settings to be like in the live site. I use both virtual and file include work fine. If you are interested in having parenth path allowed, you can change the settings to adjust to your requirements. Some Webhosts don't like using Parent Path Allowed because they find it leaves your site vulnerable... or was it the server, I didn't get that part. but win 2003 is ok. with parent path Allowed.

Reply to this topic