Advanced HTML Absolute vs. Relative Links Image Links Linking Word Documents, .pdf files, mailtos The term URL stands for Universal Resource Locator, and is pronounced like the man's name, Earl. Essentially, it means the Internet address of a web page. What's an Absolute Path? There are two ways to put links to Internet addresses on your webpages. One way is to use absolute URLs in the HREF="..." attribute (i.e., a site's entire Internet address, all the way from the http:// on down to the pagename.html). These URLs show an "absolute" path through a folder structure to a Web page, from the server down to the specific file. For example, the absolute path for this web page is: http://teachertech.rice.edu/Materials/TeacherTECH/basics/urls.html Absolute paths are essential when linking outside of your site because your browser can't locate a file on the Web unless it knows the site's exact location. When you click on an absolute path to a web page on the Internet, you have to have a live Internet connection to reach that site. This can be a problem if you want to test your own pages on your computer before making them live. For this reason, when you're linking to another page within your own site, it can be helpful to set up your links using relative paths instead of absolute paths. What's a Relative Path? Relative paths tell your browser the location of other Web pages within your site's folder structure "relative" to the page you happen to be viewing, using a shorthand of "../" to indicate movement one level up in the folder hierarchy. To move two levels up, just double the shorthand by using "../../" (Old-school DOS and UNIX users will recognize this shorthand immediately.) The page you're reading right now is in a folder called "basics". One of the images we used at the top of our main Index page (the right part of the TeacherTECH logo) is located in the images folder (which is in the TeacherTECH folder, just like the basics folder is). If we wanted to link to that image from this page, we could either write out the absolute path, like this: http://teachertech.rice.edu/Materials/TeacherTECH/banner/banner.gif Or we could write a link indicating the picture's location relative to this page's location, i.e., the "banner.gif" image in the banner folder, which is the same level as the "basics" folder, like this: ../banner/banner.gif Try both of the links out and see if they display the same picture. Sample Directory Structure To the left is the directory structure of the folders for this class. All of these files are inside a folder called TeacherTECH". There are only a few files in the "TeacherTECH" folder, but there are thirteen other folders inside the "TeacherTECH" folder (and many other files inside those thirteen folders). This file, "urls.html", is in the "basics" folder, which is inside the "TeacherTECH" folder. If we added the following code to a web page we were creating, by typing it in the Code View window of Dreamweaver. Here are some more examples: <A HREF="../index.html"> This link would take you to the index page one folder level above the page where the link appears. <A HREF="../../index.html"> This link would take you to the index page two levels above the page where the link appears. Note, when you end your URL in a "/" the browser will look for and load the index.html file in that folder, meaning that you could leave it out of either of the two preceding examples, and write them like this: <A HREF="../"> <A HREF="../../"> If you want to climb up three directory levels and then down into another branch of the filesystem tree, just append the new path like this: <A HREF="../../../content/squirrels/"> would take you to a folder two levels up and then down into a folder named "content", into a folder named "squirrels", to the index page there. Image Links By now you know enough to write a very nice, text-based home page, but it is the ability of the World Wide Web to provide pictures, technically called images, graphics, or sometimes icons, that has made it so popular. In this Primer, you'll learn how place an image on your page and also how to turn an image into a link to another page. An excellent tutorial for linking images can be found at HTML Goodies. This link will take you out of the TeacherTECH site, so you will need to choose the back button to return. Basic HTML: Images The code needed to place an image on a web site is <img src=”picture.jpg”> picture.jpg is the filename for the image that will be displayed. Linking Word (or other file type) documents You can link a word (or other file type document) the same way as an html file. You must take into consideration that the machine that is downloading the file must have the appropriate software. The relative/absolute links are done in the same manner. Example: word.doc Creating a mailto: If you are going to create an e-mail link, there are several considerations. The text that is seen needs to be written, and a mailto link must be created. You should be aware that certain software will search for e-mails listed on web site and spam is generated in this manner. I would suggest that you either write your e-mail in a 'criptic' fashion, ie. sboone at houstonisd(dot) org (this doesn't look very nice though...) - or- just state your name: E-mail the webmaster, or e-mail me. Once you have decided on the text, then you can create a hyper link: <a href= "mailto:email@service.org"> Example: E-mail me with comments The code for this link is: <a href="mailto:sboone@houstonisd.org">E-mail me with comments</a><a href="../index.html">Go Back to the Main Index Page</a> this is what it would look like on a web page. Go Back to the Main Index Page Clicking on that link should take us out of this "basics" folder, and up one level (to the "TeacherTECH" folder). Since there's an "index.html" file in the "TeacherTECH" folder, we should find ourselves back on the main TeacherTECH Index page when we click on the link. Try it. If we made a link on this page like this <a href="../../">Go Back to the Materials Folder</a> it should produce a link like this next one Go Back to the Materials Folder It should take us out of this folder, up one level (to the TeacherTECH folder), then up one more level (to the Materials folder). There is also an "index.html" file in that folder, so we should see GirlTECH Schedules & Training Materials page when we click on that link. Go ahead. give it a try. You may also find the following links useful as you continue to work with web pages. Naming and Addressing: URIs, URLs, ... http://www.w3.org/Addressing/ Advanced HTML, CSS, and DHTML http://webdeveloper.com/advhtml/ Why Switch to XHTML? http://www.webreference.com/authoring/xhtml/