Newbie: How is 'VIRTUAL' used?

L

LarryM

Hi,

It's about concept definitions.

I have seen these SSI examples:
<!-- #include FILE="..\scripts\myscr.inc" -->
<!-- #include VIRTUAL="../../thisbit/usefulbits.inc" -->

1. When do you use '#include VIRTUAL' instead of '#include FILE'?

2. A 'Virtual Directory', is that always any Directory placed outside the
default Web Directory Tree?
Or is any special 'virtual' configuration involved?

Thanks
Larry
 
L

LarryM

Sorry, but I can't follow you..
The #include directive referred to the include file, and there is no other file
that could be 'relative' the include file.
I too think it is very useful but I have a hard time to get the definitons
right..
:)
/L
 
L

LarryM

Virtual is to located a file from the root of your site.

Root Folder: webroot
<!-- #include VIRTUAL="thisbit/usefulbits.inc" -->

This would look for the file usefulbits.inc inside the folder this bit.
You cannot use the command ../ to go back a directory since you are
starting from the root by using the VIRTUAL command. If you use FILE
then you can use ../ because it is oriented to the script it is written
in.

hm..
<!-- #include VIRTUAL="../../thisbit/usefulbits.inc" -->
was an example right from the book 'Professional Active Server Pages 3.0'.
They say you can use a virtual relativ OR absolute path this way.

But if I get you right, you mean that 'virtual' should be the same as 'relative
the webroot'?

I also thought that the concept Virtual Directory first of all meant a Directory
OUTSDIE the webroot.

maybe I am still a bit confused...

/L
 
P

Paul Baker

When using FILE, you specify a file name, and it can be relative to the
current ASP file.

When using VIRTUAL, you specify something similar to a URL, but it can be
relative to the current location.

The directory structure (file system) and the vitual directory structure
(URL) are often the same, but need not be. There are various options, the
most significant of which is virtual directories, which allow them to be
different.

I tend to use FILE unless the file I want is not closely relative to the
current ASP. If it is not in the same folder or a parent folder, I usually
use VIRTUAL, because the alternative would be to use a complicated relative
file path or a full path C:\inetpub\wwwroot\... which is a really bad idea,
as it hard-codes the root folder.

This is a simple concept that I am having a hard time explaining. If what
you're thinking is not simple, you're not understanding it right.

BTW, don't put a space after the <-- or before the -->. You're not supposed
to according to the specifications. IIS does not care, but other servers,
eg. Apache do.

Paul
 
R

Roy in \(H.E.Double Toothpicks\)

On the webserver you can put one directory inside another. It's path is
just like the file system.

On the other hand you can make a virutal directory and include a folder from
somewhere else.

So a virtual directory could be htp://mysite/myVirtualDirectory.

On the file system this website would be at c:\inetpub\wwwroot, but the
myVirtualDirectory folder could be at
f:\Stinkyfiles\myVirtualDirectory

get a file from the myVirtualDirectory directory using VIRTUAL. Get a file
from the regular folder using FILE
 
L

LarryM

On Fri, 25 Jul 2003 19:28:36 -0600, "Roy in \(H.E.Double Toothpicks\)"

About VIRTUAL: '#include VIRTUAL=', 'Virtual Directory'.
(Not ot mention Virtual Application..uuhh)

Please help me complete the definitons!! /L
On the webserver you can put one directory inside another. It's path is
just like the file system.

On the other hand you can make a virutal directory and include a folder from
somewhere else.
How do you 'make' a virtual directory?
Of course, in IIS, you can make a physical directory your Default Website, but
that is not what you mean?
So a virtual directory could be http://mysite/myVirtualDirectory.
On the file system this website would be at c:\inetpub\wwwroot, but the
myVirtualDirectory folder could be at
f:\Stinkyfiles\myVirtualDirectory
Say that your original WebSit is at http://mysite/myVirtualDirectory.
Now you want to add a folder from somewhere else (ie outside the corresponding
physical directory structure) to this Website.
How do you do?
Is it in any way permanently added, or just existing when you are referring to
it?
 
L

LarryM

On Fri, 25 Jul 2003 18:00:20 -0400, "Paul Baker" <ask> wrote:

Please help me complete the definitions!! /L
Bear with me, I must clear this out!
Please correct my guessings..
When using FILE, you specify a file name, and it can be relative to the
current ASP file.
Is the '#include FILE=' form always using regular Path-notation (like in
DOS,Windows '\'), and never URL-notation?
Can the 'FILE='-form also use an absolute Path, and if so, can it then refer to
a physical directory outside the WebSite (=webroot and subdirectories)?
When using VIRTUAL, you specify something similar to a URL, but it can be
relative to the current location.
so, the '#include VIRTUAL='-form always uses the URL-notation ('/').
If it is a realtive Path, than it is relative the ASP-file in which the include
directive is used.
Can you use the 'VIRTUAL='-form to ever refer to a file outside the default
Website?
The directory structure (file system) and the vitual directory structure
(URL) are often the same, but need not be. There are various options, the
most significant of which is virtual directories, which allow them to be
different.
How do you 'construct' a virtual directory structure?

To begin with there are
1) the server's local file system (C:\, D:\ etc)
2) the WebSite (Webroot and subdirectories) (which in a way is a 'virtual'
directory, where the corresponding physical directory often
isC:\inetpub\wwwroot\MyWebSite\).
Also you may have many WebSites on the server.
3) any directory on internet referred to by an URL.

The focus is on our WebSite. Is the WebRoot in itself a Virtual directory, or is
a Virtual directory always something that is added to your Website, thus
including a directory from somewhere outside the original Website?
If so, is this Virtual Directory configured somewhere, or does it appear just
when you in some way manages to refer to it?
I tend to use FILE unless the file I want is not closely relative to the
current ASP. If it is not in the same folder or a parent folder, I usually
use VIRTUAL, because the alternative would be to use a complicated relative
file path or a full path C:\inetpub\wwwroot\... which is a really bad idea,
as it hard-codes the root folder.
So you use the 'VIRTUAL='-form to be able to give a relative path.
'relative to the current location' you say above.
But so does the 'FILE='-form (relative the ASP-file).
The difference so far is the RegularPath/URL-notation.
Could you clearify this a bit more?
This is a simple concept that I am having a hard time explaining. If what
you're thinking is not simple, you're not understanding it right.
I you have a hard time, imagine what I have..
 
P

Paul Baker

Well I could have pointed you to that, but there's nothing like having it
explained to you by real people, is there?

If you have any more questions, do not hesitate to ask.

Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,079
Messages
2,570,574
Members
47,206
Latest member
Zenden

Latest Threads

Top