Slashes in file names

T

tshad

Does it matter which slash (forward or back) in my urls or files?

I have both set up that seem to work interchangeably. But someone said this
was not the right way to do this.

For example:

<tr height="90px"
style="padding:0;background:url('../images/StaffingLogo_bg3.jpg')">
<td width="424px"><img src="..\images\StaffingLogo_FG3.jpg" width="424px"
height="90px">

Thanks,

Tom
 
S

saz

Does it matter which slash (forward or back) in my urls or files?

I have both set up that seem to work interchangeably. But someone said this
was not the right way to do this.

For example:

<tr height="90px"
style="padding:0;background:url('../images/StaffingLogo_bg3.jpg')">
<td width="424px"><img src="..\images\StaffingLogo_FG3.jpg" width="424px"
height="90px">

Thanks,

Tom
Forward "/" is for internet use, or for files located outside your
network and computer.

Backwards "\" is for local networks and your personal computer.
 
D

David Dorward

saz said:
Backwards "\" is for local networks

.... depending on protocol.
and your personal computer.

.... assuming you use Windows. UNIX based systems (like Linux, BSD or Mac OS
X) use forward slashes as directory seperators.
 
T

tshad

saz said:
Forward "/" is for internet use, or for files located outside your
network and computer.

Backwards "\" is for local networks and your personal computer.

So when I am getting images or going from page to page (redirects) on my
system I should always use "\", correct?

When I use http:, I should always use http://xxx/xx/.

Thanks,

Tom
 
D

David Dorward

tshad said:
So when I am getting images or going from page to page (redirects) on my
system I should always use "\", correct?

A relative URL is still a relative URL - so no.
 
T

tshad

David Dorward said:
A relative URL is still a relative URL - so no.

What about if I want it to be relative to the root folder (not c:, but the
virtual directory root)?

Something like:

<script language="javascript" src="\includes\Menus.js"></script>

Where the menu structure would be "c:\inetpub\wwwroot\development\includes".

I don't want to use "c:\inetpub\wwwroot\development" because the production
name might be different.

Tom
 
C

Carolyn Marenger

Forward "/" is for internet use, or for files located outside your
network and computer.

Backwards "\" is for local networks and your personal computer.

Actually the "\" is used in windows environments. Possibly some others as
well. I can't comment about the mac line, but in linux, my OS of choice,
/ is used for directories, servers, and so forth.

Carolyn
 
T

tshad

tshad said:
What about if I want it to be relative to the root folder (not c:, but the
virtual directory root)?

Something like:

<script language="javascript" src="\includes\Menus.js"></script>

Where the menu structure would be
"c:\inetpub\wwwroot\development\includes".

I don't want to use "c:\inetpub\wwwroot\development" because the
production name might be different.

I read in another article that you could use "~//", but that doesn't seem to
work here:

<script language="javascript" src="~//includes/Menus.js"></script>

Tom
 
D

Dylan Parry

tshad said:
<script language="javascript" src="\includes\Menus.js"></script>

Nope. You still use "/" here. Any time you use a slash within HTML
code[1], it should be a forward slash.

____
1. Except when you are actually attempting to display the backslash
character in, for example, a paragraph of text.
 
J

JDS

So when I am getting images or going from page to page (redirects) on my
system I should always use "\", correct?

When I use http:, I should always use http://xxx/xx/.

Thanks,

Tom

Inside HTML pages and CSS, *always* use forward slashes. "/" -- on the
question mark key. So for your original example, ALL of the slashes
should be forward-slashes! ALL OF THEM. The text was text inside an HTML
page. HTML only uses the forward-slash as a directory delimeter.

If you have a Windows PC, use Back-slashes in, for example, Windows
Explorer, to navigate directories, or on the MS-DOS command prompt. "\" --
on the "pipe" key, usually.

Technically speaking, to answer the Subject: line of the OP, "slashes" are
not part of the file name. They indicate the file path.
 
J

JDS

I read in another article that you could use "~//", but that doesn't seem to
work here:

<script language="javascript" src="~//includes/Menus.js"></script>

The tilde ("~") character is a Unix-ism (and Linux, too) that means "My
Home Directory". Tilde is (essentially) meaningless on Windows.

The extra slash is probably just a typo -- the only time you use two
slashes is between the protocol indicator ("http:" or "ftp:" for example)
and the path.
 
B

Blinky the Shark

JDS said:
The tilde ("~") character is a Unix-ism (and Linux, too) that means
"My Home Directory". Tilde is (essentially) meaningless on Windows.

To the extent that to most Windows users, it's probably "that little
wavy thing."
 
T

Toby Inkster

Carolyn said:
Actually the "\" is used in windows environments. Possibly some others
as well. I can't comment about the mac line, but in linux, my OS of
choice, / is used for directories, servers, and so forth.

Actually, on the DOS/Windows filesystem, "/" and "\" are interchangeable,
though "\" is convention. And some particular DOS/Windows applications
will insist on a "\".
 
D

Dan

tshad said:
What about if I want it to be relative to the root folder (not c:, but the
virtual directory root)?

Something like:

<script language="javascript" src="\includes\Menus.js"></script>

URLs always use forward slashes. Even "file:" URLs referring to local
system files use forward slashes even though the local operating system
convention might use backslashes.

For relative URLs to the root, you would use
src="/includes/Menus.js".
 
T

tshad

Dylan Parry said:
tshad said:
<script language="javascript" src="\includes\Menus.js"></script>

Nope. You still use "/" here. Any time you use a slash within HTML
code[1], it should be a forward slash.

But that still doesn't find the root directory (at least, I can't seem to
make it work).
 
D

David Dorward

tshad said:
Nope. You still use "/" here. Any time you use a slash within HTML
code[1], it should be a forward slash.
But that still doesn't find the root directory (at least, I can't seem to
make it work).

It should find the root directory, of course if you are accessing it over
your local file system then the root is c:\ (or whatever drive it is). You
are usually best off installing a local webserver
<http://httpd.apache.org/> for testing if you want to use root relative
URIs.
 
J

JDS

To the extent that to most Windows users, it's probably "that little
wavy thing."

Right. I can't tell you how many times I would read out a URL that had a
tilde in it (personal home page or whatever) to someone on the phone and
they would say "not working not working not working" and I'd find out
later that they had actually typed the *word* "tilde" in the URL

e.g. http://example.com/tildejeff

instead of
http://example.com/~jeff

And I would go over and poke their eyes out and rescind their computer use
privileges and poop on their 5-and-a-quarters[1] and have my cat pee in
their punchcard reader (assuming that they had that particularly advanced
I/O device) and and then I'd yell at them and tell them that their momma
was a Timex Sinclair and then I'd really get mad and mess them up. yeah.
Then I'd put my Apple IIc in their butt sideways and tell them to take it
up with Jef Raskin. Ah...how I loved that IIc.


[1] Don't know what that is? Sheesh.
 
J

JDS

It should find the root directory, of course if you are accessing it over
your local file system then the root is c:\ (or whatever drive it is). You
are usually best off installing a local webserver
<http://httpd.apache.org/> for testing if you want to use root relative
URIs.

Ah, yes. Good advice.
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top