...

View Full Version : linking folder to folder



collie
01-24-2004, 01:28 AM
I have a folder and a sub folder. The folders are named and within the folders thers is HTML CODE. I can link from the primary folder to the sub folder. But can not link back to the primary folder.
Here are my codes that I have tried.

<a href="sub folder/xxxx.html"></a> (this works)

<a href="primary/xxxx.html"></a> (this dont)

tried this:

<a href="sub folder/xxxx.html"></a> (this works)

<a href="../primary/xxxx.html"></a> (this dont)

bryndyment
01-24-2004, 03:28 AM
Try this:

<a href="../file_in_primary.html">link</a>

(using ".." takes you up into "primary", so that's all you need...)

collie
01-24-2004, 02:07 PM
Still unable to get to primary:

<a href="../file_in_primary.html">link</a>

I dont understand how the above code would see the html file thats in the primary.

me'
01-24-2004, 02:19 PM
Say you have two folders, parent, and child. Child is a subfolder of parent. You have a file in parent called 'xxx.html', and one in child called 'yyy.html'. So, your structure would look like this:
parent/
xxx.html
child/
yyy.htmlNow, imagine the user has browsed to yyy.html. If you want to link to xxx.html in yyy.html, then you'll need this relative path:
../xxx.htmlYou can imagine relative paths as a cursor. '../' means 'Take the cursor to the parent folder'. So, a relative path, '../xxx.html' means 'Take the cursor to the parent folder, and look for a file called "xxx.html"'. Here's some more complicated examples:

Structure:
root/
child1/
c1page.html
child2/
child2child1/
c2c1page.html
child2child2/
c2c2page.html
Relative paths:
../../../child1/c1page.html
will take you to c1page.html from c2c1page.html (nb: it will also work if you place the relative path in c2c2page.html)

../child2/child2child1/../child2child2/c2c2page.html
will take you from c1page.html to c2c2page.html. This path could be shorter, but that's not the point.

collie
01-24-2004, 02:44 PM
Yes its clear now. Thank you both for helping.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum