Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jun 2002
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    linking folder to folder

    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)

  • #2
    New Coder
    Join Date
    Mar 2003
    Location
    San Francisco
    Posts
    83
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try this:

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

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

  • #3
    New Coder
    Join Date
    Jun 2002
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    linking folder to folder

    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.

  • #4
    me'
    me' is offline
    Senior Coder
    Join Date
    Nov 2002
    Location
    Warwickshire, England
    Posts
    1,229
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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:
    Code:
    parent/
        xxx.html
        child/
            yyy.html
    Now, 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:
    Code:
    ../xxx.html
    You 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:
    Code:
    root/
        child1/
            c1page.html
        child2/
            child2child1/
                 c2c1page.html
            child2child2/
                 c2c2page.html
    Relative paths:
    Code:
    ../../../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.
    David House - Perfect is achieved, not when there is nothing left to add, but when there is nothing left to take away. (Antoine de St. Exupery).
    W3Schools | XHTML Validator | CSS Validator | Colours | Typography | HTML&CSS FAQ | Go get Mozilla Now | I blog!

  • #5
    New Coder
    Join Date
    Jun 2002
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    linking folder to folder

    Yes its clear now. Thank you both for helping.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •