Fun with links!
5 September 2005 22:37How 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...
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...
no subject
Date: 6 Sep 2005 16:19 (UTC)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.
no subject
Date: 7 Sep 2005 06:11 (UTC)no subject
Date: 7 Sep 2005 06:26 (UTC)(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
no subject
Date: 6 Sep 2005 19:26 (UTC)no subject
Date: 7 Sep 2005 06:06 (UTC)no subject
Date: 7 Sep 2005 06:12 (UTC)no subject
Date: 7 Sep 2005 03:46 (UTC)Er... darnit, now I feel like I'm in talking-to-five-year-old mode *and* I've made an unintentional pun. Um.
So, I think the problem is that I don't know whether you want the *concept* itself or you want to know more about how the mechanics match the concept. Not, mind you, that I'm sure I'd be able to explain it in any case!
no subject
Date: 7 Sep 2005 06:09 (UTC)no subject
Date: 7 Sep 2005 12:13 (UTC)