abilouise: (Default)
[personal profile] abilouise
How many people were reading my journal when I was talking about getting the HTML book to learn how to edit my own fucken website? Anyway, I am working on day 5, which is learning how to use links. So you all will suffer the wrath of my learning.
Eh. Fuck learning. I just hit a concept in the book that is the first one, I swear, that she does not explain in a way that I can understand. If anyone wants to explain relative and absolute pathnames to me in terms I will understand, be my guest. There may be fabulous prizes!
In other news I baked rye bread tonight but it came out more crumby than I wanted or expected it to. Phoo. But it still tastes great with good butter. No sandwiches though I think. And anyway, I don't think I'll ever be able to bake rye bread the way I really want it to come out. My least favorite thing about living outside of the metro New York area. sigh...

Date: 6 Sep 2005 16:19 (UTC)
From: [identity profile] kilroi.livejournal.com
Don't know if anyone else has yet, but I'll give it a try:

Any file on a computer has a location.
Like, the file "myfile.html"
might be at

c:/windows/something/other/myfile.html
or maybe
/home/kilroi/apache/htdocs/myfile.html

Although what it might show up as is

htt p://www.kilroi.org/myfile.html


So, you have this file myfile.html in which you are putting your happy webpage (or whatever). And this file is in a specific place.

And within an html file you can make links to other files! this is the fun hyptertext part, right?

Ok, so to link to another file you have to type in where that other file is.

I'm going to keep going with
/home/kilroi/apache/htdocs/myfile.html

aka

htt p://www.kilroi.org/myfile.html

Let's say I want to link to:

/home/kilroi/apache/htdocs/cool-stuff/fun.html

which can be found on the web as

htt p://www.kilroi.org/cool-stuff/fun.html

Ok.

I can either link to it as:

< a href = " htt p://www.kilroi.org/cool-stuff/fun.html " >

or as:

< a href = " ../cool-stuff/fun.html " >

The first one is *absolute*. It links the entire pathname of the file you are trying to get to. This is what an absolute pathname is no matter what. It doesn't matter where you start out at, it will get you to the right file.

The second one is a *relative* pathname. It is relative to the file you started with. Ie, the ".." means "go to the directory above the directory I am in now"
(aka /home/kilroi/apache/htdocs/ or www.kilroi.org, depending on how you want to think of it)
and *then* go into the directory "cool-stuff" and then find the file "fun.html". A relative filename depends on where you are already; it shows the *relation* between the two files.

Does this help even a little? I'm a bad explainer and I always end up sounding like I'm talking to a 5 year old when I don't mean to be ....

anyway, hope it helps, or someone else explained it or something.

cheers.

Date: 7 Sep 2005 06:11 (UTC)
From: [identity profile] abilouise.livejournal.com
You didn't make me feel like you're talking to a 5-year-old and I think I get it but I don't get WHY one of these would be better than the other. It sort of seems like you shouldn't need both, but I can't really explain why it feels this way.

Date: 7 Sep 2005 06:26 (UTC)
From: [identity profile] kilroi.livejournal.com
I generally think of absolute pathnames being better, because they more clearly delineate where something is. In my above example, if I use an absolute pathname as a link, no matter where I put myfile.html, it will always link to the right place.
(Of course, if you move the file you link to, you have to fix the link).

However! Let's say you had a nice gorgeous webpage built up, lots of links to itself all over the place, &c., &c. And it's all at htt p://www.kilroi.org.
But www.kilroi.org expires, and I have to get www.kilroi.net
( or www.i-am-a-loser.net). Now pointing to kilroi.org is no good, and I would have to go back and change everything, but if the organization of my *files* hadn't changed, just the server, all the links would still be correct and you wouldn't have to change anything, if you had used relative links.

So, if you think the structure of stuff with respect to the other files you are linking to will stay static, relative stuff can be nifty. However, it is harder to fix, in my mind, if you move things around, whereas if you have the full (aka absolute) path it is a little easier to see if you are linking to things in the wrong place in your original html code.

Relative versus absolute stuff is used not only in html code - so , in regular code, if you were going to ship something where the code itself never gets touched, relative links might be easier and shorter to type, or something. I suspect that most of it just comes from the UNIX commandline and being able to say
cd ../../../blah to go up 3 levels, and get the file you want, without having to type in a full pathname

Profile

abilouise: (Default)
abilouise

November 2020

S M T W T F S
1234567
8 91011121314
15161718192021
22232425262728
2930     

Style Credit

Expand Cut Tags

No cut tags
Page generated 2 January 2026 06:08
Powered by Dreamwidth Studios