New guy with Noob-ish question!

taw-tx

New Member
Hi guys and gals, just had a question about my website, and thought i'd google for a forum. Found this :)

As a student, I've just learned how to program using HTML, and with this new found talent (haha) have created a website.

Just wondering about links for things like pictures, or for another page, i've been doing things like this:

< img src="http://www.tomnetf2s.f2s.com/gallery/holidays/group100ppijpeg.jpg" >

But, thats called an absolute, erm, location? I'm not sure. My point is, I'd like to know about the other way of doing it, whereby you only put something like:

group100ppijpeg.jpg as the locaiton of the picture. It only works if its in the same folder as the page of code you link to it from, or something - can anyone enlighten me?


Thanx,
Tom
 

taw-tx

New Member
ok, i've kind of answered my own question.

i created a folder and put a simple bit of html in it:

<html>
<a href="/somewhereelse.html">next</a>

- this tried to link to my website like this:

www.tomnetf2s.f2s.com/somewhereelse.html

- which for me, means that if i change all my links to this style, then i can change my domain name and the links will all work still - which is great. just as long as i keep my folders named correctly lol

anyone still got any pointers for me, they are very welcome :)
 

Baldur McQueen

New Member
Hi taw-tx

The nr.1 thing you have to keep in mind - is that the link to the images must always be relevant to the page you are looking at (see below).

It's a good idea to keep all af your images in one folder on your server - let's say it's called images.

Now - when you want to show an image on your index.htm(l) page (the starting page the browser picks up when entering your domain) - you would simply put a link to it like this:

<img src="images/name_of_picture.jpg">

Now - let's imagine you would like to make a few html pages about gardening (or something) and you would like to keep all of them in a seperate folder (to keep your space tidy ;) ). To keep everything organized you would still keep all your images in the images folder.

You would make a folder called gardening and put various gardening pages in there. Let's say one of the gardening pages would be called roses.html - and you would like to put an image of a rose (rose.jpg) on the top. The image is the images folder.

Let's stop here and see where we are.

You have an index.html page that points to another page about roses, which is in a new folder and is linked to like this: <a href="gardening/roses.html"> from your index.html page (Direct link: http://www.tomnetf2s.f2s.com/gardening/roses.html).

In the roses.html page you want to put an image of a rose which has the direct link: http://www.tomnetf2s.f2s.com/images/rose.jpg .

NOW.........on the roses.jpg page - to put the image on top - it would be useless to put a link like this <img src="images/rose.jpg">. Why? Because the browser is now looking at a page inside the gardening folder. It tries to find another folder in there that is called images, like you told it to do - but obviously can not find it, since there is no images folder inside the gardening folder!

In this case - that is, if you are "one directory deep" in you server - you would have to make sure the browser goes one directory back, before it starts looking for the images folder. You do this by typing: ../ before the usual link. This says to the browser - go back one directory. Obviously - if you are even deeper - you can go back one directory at a time by repeating ../../../ (here I am going back three directories).

So - if you want to put your rose picture on the roses.html page - you would do it like this: <img src="../images/rose.jpg">

In short :) you can link images and pages in various folders all around your server - if you just keep in mind that the path must always be relevant to the page you are looking at right now!?! By right-clicking broken links and looking at their properties - you will usually be able to see where your problem is.

A bit long - but if I am not making sence - feel free to ask direct questions regarding this.
I have been using PHP for the last few years - so if there is something false in my explanations - I trust people will correct me :D

Good luck.
 

citrus_cyanide

New Member
By the way, so people don't bitch at you, coding in HTML isn't programming. Not trying to get technical, but some people do bitch. Just a good word for you. By the way, if you're still having troubles with this PM me ot whatever it's called. I was too lazy to read all the posts. Just tell me exactly what you ned to know, and i'll help.
 
Top