FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Relative Linking





Scorpio
Well, to ensure no problem arises and to prevent changing every link when I change domains or something, I want to use more relative linking.

Help me with the following:

1. I have a html file in my public_html folder and I want to link to my forums folder called "iforums", so when I am linking I should use /iforums, is this right? Does this also apply to all other directories similarly.

2. Now I am in a html file in a folder like this public_html/images/backgrounds , if I want to link to a file or directory in higher levels. e.g. To link to a file or directory in public_html, or public_html/images what is the code i should use.
Is this code similar for other directories or folders in higher levels as well?

3. If I am in the same above directory(backgrounds) and I want to link to a file or directory in public_html/news/headlines folder, then how should I do it?
Is this link similar for other directories also.

thats it for now, please help me fix it up. Thank you
n0obie4life
scorpio wrote:
Well, to ensure no problem arises and to prevent changing every link when I change domains or something, I want to use more relative linking.

Help me with the following:

1. I have a html file in my public_html folder and I want to link to my forums folder called "iforums", so when I am linking I should use /iforums, is this right? Does this also apply to all other directories similarly.

2. Now I am in a html file in a folder like this public_html/images/backgrounds , if I want to link to a file or directory in higher levels. e.g. To link to a file or directory in public_html, or public_html/images what is the code i should use.
Is this code similar for other directories or folders in higher levels as well?

3. If I am in the same above directory(backgrounds) and I want to link to a file or directory in public_html/news/headlines folder, then how should I do it?
Is this link similar for other directories also.

thats it for now, please help me fix it up. Thank you


1.
Code:
<a href="./iforums/">Visit my forums</a>


2.It's relative to the root of public_html. So in the example of phpBB, to link to a image while in index.php I'll use this code
Code:
<img src="./images/smiles/icon_biggrin.gif" />
Scorpio
But according to you, the folder images is inside the forums directory, right?

I want to know for something like this

You are in public_html>>dir1>>dir2>>index.html

You want to link to public_html>>dir3>>dir4>>something.html

or

to public_html>>something.html

Please give a code for this. Very Happy
Bondings
scorpio, to go back in a directory, you need to use "../", like "../../file.php" if the file.php is 2 directories below.
Scorpio
Bondings wrote:
scorpio, to go back in a directory, you need to use "../", like "../../file.php" if the file.php is 2 directories below.


You mean going up two levels, right??

Also, I want to know how to go back certain no. of levels, then go down two levels into another directory and open a file there.

Please look at my example in the previous post. Very Happy
mathiaus
scorpio wrote:
Bondings wrote:
scorpio, to go back in a directory, you need to use "../", like "../../file.php" if the file.php is 2 directories below.


You mean going up two levels, right??

No he means down which he said Rolling Eyes

eg
home/mathiaus/www/forum
to get
home/mathiaus/www/images
../images
takes back to www then to images
n0obie4life
Everything is relative to the public_html folder Confused
Scorpio
mathiaus wrote:
scorpio wrote:
Bondings wrote:
scorpio, to go back in a directory, you need to use "../", like "../../file.php" if the file.php is 2 directories below.


You mean going up two levels, right??

No he means down which he said Rolling Eyes

eg
home/mathiaus/www/forum
to get
home/mathiaus/www/images
../images
takes back to www then to images


Thanks that helped, thats what I wanted to know. Anyway, in n4l's post he gave a code like this, for linking, when you are in the public_html dir
Code:
<img src="./images/smiles/icon_biggrin.gif" />


I want to know, if that DOT just after the first double quote is necessary or not?

@n4l: I can see you are getting frustrated, but the fact is that, only now am I learning and I am not a real quick grasper and stuff.

So, you have to patient to answer my questions or not answer at all.
Very Happy
n0obie4life
The dot is just for neatness-es sake and clean coding. Also, it may help some stupid browsers that render these links wrongly Smile.
Scorpio
n0obie4life wrote:
The dot is just for neatness-es sake and clean coding. Also, it may help some stupid browsers that render these links wrongly Smile.


Sure. Then I will stick with it.

Very Happy
Daniel15
scorpio, basically, the '.' means 'current directory'.

So <img src="./images/smiles/icon_biggrin.gif" /> is the same as <img src="images/smiles/icon_biggrin.gif" />

You can put as many dots as you want... <img src="./././././././././././images/smiles/icon_biggrin.gif" />. It all means the same thing (current directory/images/smiles/icon_biggrin.gif)
n0obie4life
daniel15 is spamming.

This topic is solved and he still posted Evil or Very Mad.

-close-
Related topics
different types of websites
Icons in address bar
CSS/HTML
Doe this site support offsite-linking?
morality vs. ethics
PHP and relative/absolute paths
Linking to the main frame.
help with location
NeoHide - Linking Point
How do I center my layout
Randomness is an illusion. [philosophy/science]
Relative URL, referring to uplevel directory
Looking For a Simple Example of Linking php to mysql
Linking to MP3's?
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.