Connecting Tech Pros Worldwide Forums | Help | Site Map

Include File or Include Virtual

Bryan Harrington
Guest
 
Posts: n/a
#1: Jul 19 '05
Hello all.. I'm working on an application that I'd like to use some shared
files.

Right now my directory structure is:

/ (root)
.../Shared/
.../Reports/
.../Tools/

I would like to have CSS, shared functions etc.. in the shared folder and
use them in the root, reports and tools.

So.. in my dev environment I don't have a problem, but I have a remote
developer that wants to install in a subdirectory.. so all my includes don't
work..

<!--#INCLUDE FILE="shared/Common.asp"-->

should I change to virtual? I'm stuck on how to make this work in both
installing in a root web situation, and a sub directory situation.

Thoughts?



Manohar Kamath [MVP]
Guest
 
Posts: n/a
#2: Jul 19 '05

re: Include File or Include Virtual


Use absolute paths for common elements (includes, stylesheets, etc.) than
relative paths. Takes care of many problems than you know :)

--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com


"Bryan Harrington" <news@psacake.com> wrote in message
news:euwcqPaFEHA.1128@TK2MSFTNGP11.phx.gbl...[color=blue]
> Hello all.. I'm working on an application that I'd like to use some shared
> files.
>
> Right now my directory structure is:
>
> / (root)
> .../Shared/
> .../Reports/
> .../Tools/
>
> I would like to have CSS, shared functions etc.. in the shared folder and
> use them in the root, reports and tools.
>
> So.. in my dev environment I don't have a problem, but I have a remote
> developer that wants to install in a subdirectory.. so all my includes[/color]
don't[color=blue]
> work..
>
> <!--#INCLUDE FILE="shared/Common.asp"-->
>
> should I change to virtual? I'm stuck on how to make this work in both
> installing in a root web situation, and a sub directory situation.
>
> Thoughts?
>
>[/color]


Aaron Bertrand [MVP]
Guest
 
Posts: n/a
#3: Jul 19 '05

re: Include File or Include Virtual


> <!--#INCLUDE FILE="shared/Common.asp"-->[color=blue]
>
> should I change to virtual? I'm stuck on how to make this work in both
> installing in a root web situation, and a sub directory situation.[/color]

<!--#include virtual="/shared/common.asp"-->

FWIW, I *always* include this way. I never use FILE...

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/




Aaron Bertrand [MVP]
Guest
 
Posts: n/a
#4: Jul 19 '05

re: Include File or Include Virtual


Do you mean <!--#include file="c:\inetpub\wwwroot\shared\common.css"-->
?

If so, I can think of at least one problems with this, and that is that your
web host might change the location of the webroot, or create virtual
directories to some or all of your files.

If you have a sane directory structure, referencing virtual from the root
should work perfectly, and isn't vulnerable to changes to the actual file
system.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Manohar Kamath [MVP]" <mkamath@TAKETHISOUTkamath.com> wrote in message
news:efATThaFEHA.3372@TK2MSFTNGP10.phx.gbl...[color=blue]
> Use absolute paths for common elements (includes, stylesheets, etc.) than
> relative paths. Takes care of many problems than you know :)
>
> --
> Manohar Kamath
> Editor, .netWire
> www.dotnetwire.com
>
>
> "Bryan Harrington" <news@psacake.com> wrote in message
> news:euwcqPaFEHA.1128@TK2MSFTNGP11.phx.gbl...[color=green]
>> Hello all.. I'm working on an application that I'd like to use some
>> shared
>> files.
>>
>> Right now my directory structure is:
>>
>> / (root)
>> .../Shared/
>> .../Reports/
>> .../Tools/
>>
>> I would like to have CSS, shared functions etc.. in the shared folder
>> and
>> use them in the root, reports and tools.
>>
>> So.. in my dev environment I don't have a problem, but I have a remote
>> developer that wants to install in a subdirectory.. so all my includes[/color]
> don't[color=green]
>> work..
>>
>> <!--#INCLUDE FILE="shared/Common.asp"-->
>>
>> should I change to virtual? I'm stuck on how to make this work in both
>> installing in a root web situation, and a sub directory situation.
>>
>> Thoughts?
>>
>>[/color]
>
>[/color]


Bryan Harrington
Guest
 
Posts: n/a
#5: Jul 19 '05

re: Include File or Include Virtual


Well.. that's part of my problem I suppose.. I don't know what the absolute
path will be if the end user decides to install it in a subdirectory instead
of it's own virtual web.


"Manohar Kamath [MVP]" <mkamath@TAKETHISOUTkamath.com> wrote in message
news:efATThaFEHA.3372@TK2MSFTNGP10.phx.gbl...[color=blue]
> Use absolute paths for common elements (includes, stylesheets, etc.) than
> relative paths. Takes care of many problems than you know :)
>
> --
> Manohar Kamath
> Editor, .netWire
> www.dotnetwire.com
>
>
> "Bryan Harrington" <news@psacake.com> wrote in message
> news:euwcqPaFEHA.1128@TK2MSFTNGP11.phx.gbl...[color=green]
> > Hello all.. I'm working on an application that I'd like to use some[/color][/color]
shared[color=blue][color=green]
> > files.
> >
> > Right now my directory structure is:
> >
> > / (root)
> > .../Shared/
> > .../Reports/
> > .../Tools/
> >
> > I would like to have CSS, shared functions etc.. in the shared folder[/color][/color]
and[color=blue][color=green]
> > use them in the root, reports and tools.
> >
> > So.. in my dev environment I don't have a problem, but I have a remote
> > developer that wants to install in a subdirectory.. so all my includes[/color]
> don't[color=green]
> > work..
> >
> > <!--#INCLUDE FILE="shared/Common.asp"-->
> >
> > should I change to virtual? I'm stuck on how to make this work in both
> > installing in a root web situation, and a sub directory situation.
> >
> > Thoughts?
> >
> >[/color]
>
>[/color]


Manohar Kamath [MVP]
Guest
 
Posts: n/a
#6: Jul 19 '05

re: Include File or Include Virtual


I meant <!--#include virtual="/common/include.asp" -->

The problem with relative paths is, the files could move from one directory
to another, and you need to change them unnecessarily.

--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com


"Aaron Bertrand [MVP]" <aaron@TRASHaspfaq.com> wrote in message
news:%23RasHwaFEHA.3080@tk2msftngp13.phx.gbl...[color=blue]
> Do you mean <!--#include file="c:\inetpub\wwwroot\shared\common.css"-->
> ?
>
> If so, I can think of at least one problems with this, and that is that[/color]
your[color=blue]
> web host might change the location of the webroot, or create virtual
> directories to some or all of your files.
>
> If you have a sane directory structure, referencing virtual from the root
> should work perfectly, and isn't vulnerable to changes to the actual file
> system.
>
> --
> Aaron Bertrand
> SQL Server MVP
> http://www.aspfaq.com/
>
>
> "Manohar Kamath [MVP]" <mkamath@TAKETHISOUTkamath.com> wrote in message
> news:efATThaFEHA.3372@TK2MSFTNGP10.phx.gbl...[color=green]
> > Use absolute paths for common elements (includes, stylesheets, etc.)[/color][/color]
than[color=blue][color=green]
> > relative paths. Takes care of many problems than you know :)
> >
> > --
> > Manohar Kamath
> > Editor, .netWire
> > www.dotnetwire.com
> >
> >
> > "Bryan Harrington" <news@psacake.com> wrote in message
> > news:euwcqPaFEHA.1128@TK2MSFTNGP11.phx.gbl...[color=darkred]
> >> Hello all.. I'm working on an application that I'd like to use some
> >> shared
> >> files.
> >>
> >> Right now my directory structure is:
> >>
> >> / (root)
> >> .../Shared/
> >> .../Reports/
> >> .../Tools/
> >>
> >> I would like to have CSS, shared functions etc.. in the shared folder
> >> and
> >> use them in the root, reports and tools.
> >>
> >> So.. in my dev environment I don't have a problem, but I have a remote
> >> developer that wants to install in a subdirectory.. so all my includes[/color]
> > don't[color=darkred]
> >> work..
> >>
> >> <!--#INCLUDE FILE="shared/Common.asp"-->
> >>
> >> should I change to virtual? I'm stuck on how to make this work in both
> >> installing in a root web situation, and a sub directory situation.
> >>
> >> Thoughts?
> >>
> >>[/color]
> >
> >[/color]
>
>[/color]


Manohar Kamath [MVP]
Guest
 
Posts: n/a
#7: Jul 19 '05

re: Include File or Include Virtual


If that's the case, you are better off with a relative path. Actually,
unless you don't move your files around that much, you shouldn't have a
problem.

e.g.
<!--#include virtual="../common/include.asp"-->

--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com


"Bryan Harrington" <news@psacake.com> wrote in message
news:eIlyqGbFEHA.2472@TK2MSFTNGP10.phx.gbl...[color=blue]
> Well.. that's part of my problem I suppose.. I don't know what the[/color]
absolute[color=blue]
> path will be if the end user decides to install it in a subdirectory[/color]
instead[color=blue]
> of it's own virtual web.
>
>
> "Manohar Kamath [MVP]" <mkamath@TAKETHISOUTkamath.com> wrote in message
> news:efATThaFEHA.3372@TK2MSFTNGP10.phx.gbl...[color=green]
> > Use absolute paths for common elements (includes, stylesheets, etc.)[/color][/color]
than[color=blue][color=green]
> > relative paths. Takes care of many problems than you know :)
> >
> > --
> > Manohar Kamath
> > Editor, .netWire
> > www.dotnetwire.com
> >
> >
> > "Bryan Harrington" <news@psacake.com> wrote in message
> > news:euwcqPaFEHA.1128@TK2MSFTNGP11.phx.gbl...[color=darkred]
> > > Hello all.. I'm working on an application that I'd like to use some[/color][/color]
> shared[color=green][color=darkred]
> > > files.
> > >
> > > Right now my directory structure is:
> > >
> > > / (root)
> > > .../Shared/
> > > .../Reports/
> > > .../Tools/
> > >
> > > I would like to have CSS, shared functions etc.. in the shared folder[/color][/color]
> and[color=green][color=darkred]
> > > use them in the root, reports and tools.
> > >
> > > So.. in my dev environment I don't have a problem, but I have a remote
> > > developer that wants to install in a subdirectory.. so all my includes[/color]
> > don't[color=darkred]
> > > work..
> > >
> > > <!--#INCLUDE FILE="shared/Common.asp"-->
> > >
> > > should I change to virtual? I'm stuck on how to make this work in both
> > > installing in a root web situation, and a sub directory situation.
> > >
> > > Thoughts?
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


Aaron Bertrand - MVP
Guest
 
Posts: n/a
#8: Jul 19 '05

re: Include File or Include Virtual


Okay, I was confused because that is not an "absolute" path... what you're
demonstrating is, actually, a relative path.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/




"Manohar Kamath [MVP]" <mkamath@TAKETHISOUTkamath.com> wrote in message
news:OI4fZfbFEHA.712@tk2msftngp13.phx.gbl...[color=blue]
> I meant <!--#include virtual="/common/include.asp" -->
>
> The problem with relative paths is, the files could move from one[/color]
directory[color=blue]
> to another, and you need to change them unnecessarily.[/color]


Manohar Kamath [MVP]
Guest
 
Posts: n/a
#9: Jul 19 '05

re: Include File or Include Virtual


I think it is the semantics... the /common/includes is an absolute path
although the domain has been left off. But one can argue it is relative to
the root.

--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com


"Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message
news:%23YGTvYdFEHA.2512@TK2MSFTNGP10.phx.gbl...[color=blue]
> Okay, I was confused because that is not an "absolute" path... what you're
> demonstrating is, actually, a relative path.
>
> --
> Aaron Bertrand
> SQL Server MVP
> http://www.aspfaq.com/
>
>
>
>
> "Manohar Kamath [MVP]" <mkamath@TAKETHISOUTkamath.com> wrote in message
> news:OI4fZfbFEHA.712@tk2msftngp13.phx.gbl...[color=green]
> > I meant <!--#include virtual="/common/include.asp" -->
> >
> > The problem with relative paths is, the files could move from one[/color]
> directory[color=green]
> > to another, and you need to change them unnecessarily.[/color]
>
>[/color]


Jeff Cochran
Guest
 
Posts: n/a
#10: Jul 19 '05

re: Include File or Include Virtual


On Tue, 30 Mar 2004 07:20:16 -0600, "Manohar Kamath [MVP]"
<mkamath@TAKETHISOUTkamath.com> wrote:
[color=blue]
>I think it is the semantics... the /common/includes is an absolute path
>although the domain has been left off. But one can argue it is relative to
>the root.[/color]

No, it's a relative path. Absolute paths are specified absolutely.
:)

Jeff
Manohar Kamath [MVP]
Guest
 
Posts: n/a
#11: Jul 19 '05

re: Include File or Include Virtual


I did specify is absolutely, it is not relative to anything.

If I specified it as ../common/includes.asp, then it would be relative, cos
it can only work with files that are in a certain folder.

http://webdesign.about.com/library/weekly/aa040502a.htm

--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com


"Jeff Cochran" <jcochran.nospam@naplesgov.com> wrote in message
news:406c915f.431600638@msnews.microsoft.com...[color=blue]
> On Tue, 30 Mar 2004 07:20:16 -0600, "Manohar Kamath [MVP]"
> <mkamath@TAKETHISOUTkamath.com> wrote:
>[color=green]
> >I think it is the semantics... the /common/includes is an absolute path
> >although the domain has been left off. But one can argue it is relative[/color][/color]
to[color=blue][color=green]
> >the root.[/color]
>
> No, it's a relative path. Absolute paths are specified absolutely.
> :)
>
> Jeff[/color]


Aaron Bertrand [MVP]
Guest
 
Posts: n/a
#12: Jul 19 '05

re: Include File or Include Virtual


>I did specify is absolutely, it is not relative to anything.

Yes, / is relative to the root. Absolute means "FULL PATH"

A


Manohar Kamath [MVP]
Guest
 
Posts: n/a
#13: Jul 19 '05

re: Include File or Include Virtual


At best, it is relative to the domain (say www.something.com). It is not
relative to the root, since you mention the root in the path.


--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com


"Aaron Bertrand [MVP]" <aaron@TRASHaspfaq.com> wrote in message
news:uCN3i6nFEHA.3984@TK2MSFTNGP10.phx.gbl...[color=blue][color=green]
> >I did specify is absolutely, it is not relative to anything.[/color]
>
> Yes, / is relative to the root. Absolute means "FULL PATH"
>
> A
>
>[/color]


Aaron Bertrand [MVP]
Guest
 
Posts: n/a
#14: Jul 19 '05

re: Include File or Include Virtual


/folder/file.asp is relative to the root
.../folder/file.asp is relative to the current folder

Absolute would say http://www.something.com/folder/file.asp or
c:\inetpub\wwwroot\folder\file.css

But I don't feel like arguing anymore, so you win, if you want.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Manohar Kamath [MVP]" <mkamath@TAKETHISOUTkamath.com> wrote in message
news:ueRh1GoFEHA.2512@TK2MSFTNGP10.phx.gbl...[color=blue]
> At best, it is relative to the domain (say www.something.com). It is not
> relative to the root, since you mention the root in the path.[/color]


Closed Thread