HTML has two types of paths that are used to reference objects (image, media file) and pages (folders).
Article by Gary Larocque
Defining paths in HTML is filledwith mystery and intrigue, so please sit back and enjoy theshow.
Drum Roll Please!
I would like to introduce two of my closest friends, Absolute and Relative Paths.
Ok, so I went overboard with my introduction but as long as Igot your attention.
As I mentioned, HTML has two types of paths that are used toreference objects (image, media file) and pages (IGLOOfolders).
A path that uses the full URL to point toan object or page.
For example, the absolute path to the IGLOO powered chickletis:
Absolute paths are required when you are sending a visitor toanother site.
For example, I came across a blog that interested me on the IGLOO democommunity that I wanted to reference. Since it is not part ofmy community or site I would lnik to it using the relative pathlike so:
Relative paths are the most common way to link to objects andunlike absolute paths, realtive pathing has two options.
Document Relative Paths
Relative paths allow you to move up and down your sitestructure.
I want to add a link from my pathing_101.html page to thehome.html page. As you can see the pathing_101.html page is twofolders deep in my site structure.
For each folder I want to travel up my hierachy I need to add:../ (../ = 1 folder up the site structure )
One advantage of relative paths is that you can rename a folderand it won't effect the path.
Root Relative Path
Root paths are a nice way to jump to an object in and entirlynew section of your site or community without having to count yourway around. You always work from the top down when using Rootpaths.
Now the big question, which one do I use?
Tune in next week for the continuing story of Objects and Pages,How do I get there?
Ok, ok, I will not make you wait. Root pathing is by far thebest option for a few reasons,
- No counting required
- Its less typing
- Looks cleaner in your code
Well they're not really reasons, just my personal choice. If wewant to get technical, there is one obvious reason for choosingdocument over root paths and that is when using backend scriptinglanguages like php and asp (include files),but that is another topic all together.