#include virtual= or #include file=

T

Trevor L.

Blank
What is the difference between virtual= and file=?
w3schools says this but it doesn't add anything to my knowledge
It does not say what a virtual directory is !!

Use the virtual keyword to indicate a path beginning with a virtual
directory.
If a file named "header.inc" resides in a virtual directory named /html, the
following line would insert the contents of "header.inc":

<!-- #include virtual ="/html/header.inc" -->


I have seen some tutorials which use virtual=, but with no explanation
 
J

Jon Spivey

BlankHi,

Include virtual takes it's path starting from the site root, so for example
<!-- #include virtual ="/html/header.inc" -->
Will always be
http://you.com/html/header.inc
regardless of which directory the include is in, the include virtual
directive always starts with / to indicate site root. Include file takes
it's path relative to the current page, so if you have a page
http://you.com/folder/page.asp
then in that page you put
<!-- #include file="../html/header.inc" -->
the include would be at
http://you.com/html/header.inc


--
Cheers,
Jon
Microsoft MVP

What is the difference between virtual= and file=?
w3schools says this but it doesn't add anything to my knowledge
It does not say what a virtual directory is !!

Use the virtual keyword to indicate a path beginning with a virtual
directory.
If a file named "header.inc" resides in a virtual directory named /html, the
following line would insert the contents of "header.inc":
<!-- #include virtual ="/html/header.inc" -->



I have seen some tutorials which use virtual=, but with no explanation
 
G

Guest

To answer your other question about "virtual" directories, I believe any
subfolder you place in the root is a "virtual" directory. This seems to come
from IIS where you can identify different directories as virtual to the
rootweb folder.
 
J

Jon Spivey

Actually any directory can be a virtual directory - it doesn't have to be
under the web root. Say your web root is at c:\inetpub\wwwroot and you want
to add a folder located at c:\YourFolder to your web site in IIS you can go
New - Virtual Directory then browse to c:\YourFolder give your new virtual
directory a name say MyVirtualDirectory and now
http://localhost/MyVirtualDirectory will show the contents of c:\YourFolder.

That said it's probably not much use if you're using a shared host as you'll
just have one physical location for your web site and probably won't be
allowed to create virtual directories.

--
Cheers,
Jon
Microsoft MVP

Dan L said:
To answer your other question about "virtual" directories, I believe any
subfolder you place in the root is a "virtual" directory. This seems to
come
from IIS where you can identify different directories as virtual to the
rootweb folder.

Trevor L. said:
Blank
What is the difference between virtual= and file=?
w3schools says this but it doesn't add anything to my knowledge
It does not say what a virtual directory is !!

Use the virtual keyword to indicate a path beginning with a virtual
directory.
If a file named "header.inc" resides in a virtual directory named /html,
the
following line would insert the contents of "header.inc":

<!-- #include virtual ="/html/header.inc" -->


I have seen some tutorials which use virtual=, but with no explanation
--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website: http://trevorl.mvps
 

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

Top