Virtual path for stylesheet doesn't work

G

Guest

Why does FrontPage 2003 not render pages in preview/design mode with
stylesheets when the stylesheet is linked with a virtual path? For example,
my directory structure is as follows:

Root
- css
- default.css

If I use this link on a page in the root, then FrontPage does not pick up
the stylesheet in the designer window:

<link rel="stylesheet" type="text/css" href="/css/default.css" />

If I change it to a relative path, then it works:

<link rel="stylesheet" type="text/css" href="css/default.css" />

Is there any way to get it to work with a virtual path?

Thanks,
Adam
 
M

Murray

Actually, that is not a virtual path, it's a site root relative path, and
I'm told that they will not work in FP.
 
T

Thomas A. Rowe

FP can not manage virtual path links. Use FP to insert the CSS link, and FP will then manage it
across all pages within the current web / site/

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 
S

Steve Easton

<link rel="stylesheet" type="text/css" href="/css/default.css" />

Is a path telling the browser that the css file lives outside of the root.
( outside of the web )

<link rel="stylesheet" type="text/css" href="css/default.css">

is correct. Notice I removed the / just before the closing >


--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer
 
G

Guest

Steve Easton said:
<link rel="stylesheet" type="text/css" href="/css/default.css" />

Is a path telling the browser that the css file lives outside of the root.
( outside of the web )

Actually Steve, that is completely incorrect. That is a root-relative (or
virtual) path, and it tells the browser to start at the root ("/"), and make
its way down to the /css directory.

<link rel="stylesheet" type="text/css" href="css/default.css">

is correct. Notice I removed the / just before the closing >

That is not "correct". That is just another way to write the path, which
happens to be a "relative" url, not a "virtual" or "root-relative" url. It
appears that FrontPage cannot work with virtual urls for stylesheets, only
relative urls. What a bummer.

Adam
 
G

Guest

Thomas A. Rowe said:
FP can not manage virtual path links. Use FP to insert the CSS link, and FP will then manage it
across all pages within the current web / site/

Thanks, that's what I was afraid of. What a bummer, I can't believe MS
would leave a hole like that. Luckily the dynamic web templates take care of
changing the url in non-editable regions automatically, but I hate knowing
that FP is changing my supposedly un-editable template code.
 
S

Steve Easton

Ok I stand corrected on the terminology.
However, <link rel="stylesheet" type="text/css" href="/css/default.css" />
tells FrontPage to look "above" the root and it won't work.

<link rel="stylesheet" type="text/css" href="css/default.css" >
tells FrontPage that the css folder is in the root and default.css lives inside css.

--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer
 
T

Thomas A. Rowe

IMHO, one of the best features of all versions of FP is it's management of links between pages when
you move or rename files.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 
S

Stefan B Rusynko

The link /css/default.css is absolute relative to the root web (parent pathing)
That pathing will only be supported locally if your server supports parent pathing (set in IIS, rootweb properties) and only in your
root web (not subwebs)
If you are using an online server you need to contact the host and see it they support parent pathing

--




| Why does FrontPage 2003 not render pages in preview/design mode with
| stylesheets when the stylesheet is linked with a virtual path? For example,
| my directory structure is as follows:
|
| Root
| - css
| - default.css
|
| If I use this link on a page in the root, then FrontPage does not pick up
| the stylesheet in the designer window:
|
| <link rel="stylesheet" type="text/css" href="/css/default.css" />
|
| If I change it to a relative path, then it works:
|
| <link rel="stylesheet" type="text/css" href="css/default.css" />
|
| Is there any way to get it to work with a virtual path?
|
| Thanks,
| Adam
|
 
G

Guest

Steve, I appreciate your help, but I feel I need to correct you.

Steve Easton said:
Ok I stand corrected on the terminology.
However, <link rel="stylesheet" type="text/css" href="/css/default.css" />
tells FrontPage to look "above" the root and it won't work.

This syntax, with the "/" at the beginning of the path, tells FrontPage to
start looking from the root of the website. Any browser that sees this page
will know to look from the root of the website as well, since a browser has
no way of navigating to a folder outside/above the root of the website. This
is standard, but maybe is something you have not yet used in your web
development.
<link rel="stylesheet" type="text/css" href="css/default.css" >
tells FrontPage that the css folder is in the root and default.css lives inside css.

This is not correct at all. This tells FrontPage or any browser to start in
whatever directory this web-page-with-the-link is currently in, and then
navigate downwards from there.

Imagine a directory structure like so:

Root
/ Dir1
/Dir2
/css

Let's say our page, page.htm is in the Dir2 directory. Then a path like
href="css/default.css" on that page would tell FrontPage or a browser to
start in the /Dir2 directory, and then go down one directory to the /css
folder.

This type of link is a relative link. A relative link specifies the name of
the file to be linked to only as it is related to the current document.

Adam
 
G

Guest

Stefan, you are not correct.

Stefan B Rusynko said:
The link /css/default.css is absolute relative to the root web (parent pathing)

Parent pathing is using "../" to navigate to parent directories. Using a
"/" at the beginning of a path is called a virtual path, or a root-relative
path.
That pathing will only be supported locally if your server supports parent pathing (set in IIS, rootweb properties) and only in your
root web (not subwebs)
If you are using an online server you need to contact the host and see it they support parent pathing

The "Enable Parent Paths" option in IIS controls whether or not "../" paths
can be used or not. If set to "Yes", then asp include files can use "../" in
the paths to access parent directories, like so:

<!--include file="../fileinparentdir.asp"-->

If this is set to "No", then "../" paths cannot be used. If set to "No",
then you have to use root-relative paths that begin with a "/" instead, like
so:

<!--include virtual="/dir/dir/file.asp"-->

So you are incorrect. If your host does not allow parent pathing, then they
are restricting the use of "../", and your only option is to use
root-relative paths that start with a "/".

Don't take my word for it, please see:
http://support.microsoft.com/default.aspx?scid=kb;en-us;332117
http://www.quadrahosting.com.au/kb/article-21.html

I am really surprised to be getting incorrect information from MVPs.

Regardless, your answer has no bearing on my original question, as the
Enable Parent Paths option only applies to asp include files, and not other
types of links on web pages.

Adam
 
T

Thomas A. Rowe

Bottom-line... If you want FP to manage your links, then you can't use "/" as the beginning of the
path statement.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 

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