Hi, guys. How are you today?
It has been pretty misty here since yesterday.
I cannot wash my clothes. It is not good.
Well, can I ask you something pretty difficult to understand???
Actually what does this mean???
code:
<a href="/">xxxx</a>
Why this code works without telling file name?
And how about this one?
code:
<a href="tom /">xxx</a>
What is the difference between href="tom.htm" and href="tom /"?
Hiroki: Well it all relates to the kind of links we can have:
folder/file.htm
../folder/file.htm
../../folder/file.htm
These are all relative to where the current file is stored.
I have found when you start to do a lot of includes (see War Mage's templates tutorial at the GN) it is very handy to make the links and image paths relative to the root. So your might have:
/folder/file.htm
Now if I wanted to link back to my home page I could use this:
/index.php
but as it will default to the index file (and if it doesn't you can make it) then I much prefer to get rid of the file name so it becomes:
/
as you can't have an empty set of A tags.
I have no idea what:
tom /
is all about but (unless someone knows of a good reason for it) I'd avoid it as it looks like it could cause problems.
quote:but as it will default to the index file (and if it doesn't you can make it) then I much prefer to get rid of the file name so it becomes:
/
For some reason -- can't explain why -- I've always been strangely wary of just linking to "/". It's probably an irrational ... uh ... "wariness," but I always avoided it.
I mean, linking to just "/" makes sense, but I guess I was afraid some browser might go stupid seeing just a slash. I assume no one has ever had any problems with it?
Nope, browsers handle it fine. Linking to "/" is the best way to link to the front/entrance page of your site, in my opinion.
Hiroki, if you meant "tom/" (without the space), that will link to the directory named "tom" within the current directory. So, if the page /foo/bar/baz.html links to "tom/", then the link will lead to /foo/bar/tom/. Note that linking to just "tom" would also work, but including the trailing slash clarifies exactly what you're linking to.
Emps, you said "you can't have an empty set of A tags"; what did you mean by this? If you meant that you can't link to "" (as in, <a href=""> ), you're incorrect - linking to "" is equivalent to linking to the current page. (This is convenient when you want to link to an anchor on the current page, with href="#anchor", or send paramaters to the current page with href="?foo=bar".)
Hi, guys. How are you?
Great to hear from you, guys.
Many many thanks for your replies.
Could I ask a bit more?
Emp:
quote:Now if I wanted to link back to my home page I could use this:
/index.php
but as it will default to the index file (and if it doesn't you can make it) then I much prefer to get rid of the file name so it becomes:
/
Actually I am cunfused where those index file has to be.
For example, There are two htm files. One is home.htm, which is my index page. And another called tom.htm. Do you stay in the same folder when I use those just slash thing?
And I have been wondering what is the difference between /image/hiroki.jpg and image/hiroki.jpg
In my example, hiroki.jpg is inside of folder image, isn't it?
What does slash in front of the first example do???
Hmm...Please help.
Hiroki Kozai
[This message has been edited by Hiroki (edited 08-01-2003).]
The difference is that the link with a leading slash means "start at the root of this website," but the one without a trailing slash means "start at the folder that i'm already in."
Hi, Slime.
Many many thanks for making good example.
Very kind of you.
Just wonder if those two example links are other way around???
Slash takes to root folder, doesn't it?
I found this kind of address when I surf.
But feel very strange. Why can I see the html life without seeing something like
code:
http://www.hiroki.org/home/hiroki.htm
Hmm....confused.
I alwasy make sub folder in the root folder like folders called htm, css, image, js and so on. Then always my path looks like <a href="../htm/hiroki.htm">
I think this *consistent* way is pretty good. I don't see the point to locate one folder into another.......
From: soon to be "the land down under" Insane since: Jan 2001
posted 08-01-2003 10:31
It has to do with the way a web server is set up. There are certain file names that are set as default so that the server knows which page to serve up.
But if you go to www.blueskynet.as/alo/ozone, you'll notice that you get a listing of the files in that directory since there's no index.html file in there and the web server doesn't have a default page to present.
Note that you can use any file as your default, it doesn't have to be index.html
quote:But if you go to www.blueskynet.as/alo/ozone, you'll notice that you get a listing of the files in that directory since there's no index.html file in there and the web server doesn't have a default page to present.
Yes, I understand that.
So let myself clear.
If my folder including index.htm or index.html, I don't have to say something like:
It does, however, depend on the server you're using. A server can be set to use any file name like that, not just "index.html". (Some servers, for instance, may also look for "main.html", but not all servers.)
However, 99% of the time, index.html will work.
By the way; you said that you usually put all of your HTML files in an "htm" directory. Personally, I would suggest organizing slightly differently - rather than putting all your HTML files in one directory, try using multiple directories (however many are necessary) to categorize your web site into logical groups.
For instance, on my site, I have an "images" directory. It has an index.html inside it, so I can give people the link http://www.slimeland.com/images/ , and it brings them to my images page. The advantage of this is that they know where they're going *before* they click on the link, just by looking at the URL. Obviously, a link that ends in "images" will have some sort of picture gallery.
That's just one example. It doesn't really matter until you have a full web site with different types of content, but when you do, it's nice to have clean, simple, descriptive URLs like that. It can also help if your web site starts getting large, because the organization will keep things from getting out of hand. (Files will be easy to find.)
Another advantage of doing it this way is in case you ever decide to switch over to a PHP-based site or some other server-side scripting, you won't have to change the extension.
That is if "index.htm" suddenly became "index.php" or "index.asp", you don't have to do any find and replace, because the server will search for any page named "index".
Hi, guys. Many thanks for your explanations.
Well, sounds good, isn't it?
I'd love to make it easy for users.
From point of view, user can easy to understand where they are going to.
Many thanks a lot.
Have a happy Monday.
Cya.