1. This website uses cookies. By continuing to use this website you are giving consent to cookies being used.
    For information on cookies and how you can disable them visit our Cookie Usage page.
    Dismiss Notice

HTML Relative / Absolute Hyperlinks in a Template

Discussion in 'Web Development' started by TotallyInconspicuous9999, May 6, 2010.

  1. Hi there,

    I'm having issues with my web template; I'm trying to make a professional portfolio for school. My problem is, I'm trying to code a secondary template (For classes) that has two frames; one on the left, with all the names of the projects/work I've done, and one on the right where when you mouseover the names of the projects, it brings up a preview. My problem is, the template is in the Classes folder. The web pages I want to use the template for are in the CIW, Networking, Database, and Math subfolders in the Class folder. I made the src for the frame in the template just frame1.html. When I create a child page from the template, it's looking for the frame in the same directory as the template was in. The frames are going to be in the same directory as the base pages (CIW, Networking, etc). How can I write an absolute hyperlink for that, or how do I change it so the template doesn't change to hyperlink to find the file in the base directory?
    Thanks :)
     
  2. ishkey

    ishkey Moderator, Logos, Sports Crests Staff Member Verified Member

    An Absolute link defines the location of the document absolutely including the protocol to use to get the document, the server to get it from, the directory it is located in, and the name of the document itself.
    Code:
    <a href = "http://www.yourwebsite.com/directory/frame1.html">here</a>
    
    A Relative link on the other hand takes advantage of the fact that the server knows where the current document is. Thus, if we want to link to another document in the same directory, we don't need to write out the full URL. All we need to use is the name of the file.
    Code:
    <a href = "frame1.html">here</a>
    <a href = "frame1.html">here</a>