d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Iso Some Help With Url's
Add Reply New Topic New Poll
Member
Posts: 31,187
Joined: Aug 31 2008
Gold: 28,306.50
Trader: Trusted
Jan 6 2013 05:17pm
here's my problem.

would anyone be willing to maybe breakdown how this works, maybe do the first 1 or 2 of these and explain it to me?


Absolute vs Relative Path
Give an HTML page found at the absolute URL: http://stungeye.com/school/index.php

If this page contains the following collection of links, provide the equivalent absolute path for each:

1) <a href="/">Link Text</a>
2) <a href="/test/tester.php">Link Text</a>
3) <a href="test/tester.php">Link Text</a>
4) <a href="tester.php">Link Text</a>
5) <a href="/tester.php">Link Text</a>
6) <a href="?ghost=grins">Link Text</a>
7) <a href="#grinning">Link Text</a>
8) <a href="test/index.php?ghost=grins">Link Text</a>
9) <a href="/#grinning">Link Text</a>


here's a guide on URL's.


http://www.skorks.com/2010/05/what-every-developer-should-know-about-urls/

idk If im understanding what i need to do here.
Member
Posts: 10,812
Joined: Oct 15 2009
Gold: Locked
Warn: 20%
Jan 6 2013 07:54pm
relative path: I call you on the phone and tell you to take walk 100 yards north, and 30 yards east.
absolute path: I call you on the phone and tell you to go to 1313 Elm Street.

The relative path is the path based on your current location (and will only work from that location, if I had called someone at a different location and told them to go 100m north, 30m east; they would end up the wrong spot), the absolute path will work no matter where you are.

Code
Your current "location" is http://stungeye.com/school/
The root of the current "location" is http://stungeye.com/

given the instructions "/test/tester.php" (#2), it means erase everything but the root of the path, and then append, so the absolute path is: http://stungeye.com/test/tester.php

given the instruction "test/tester.php" (#3), it means just append that to the end of your current location, so the absolute path is: http://stungeye.com/school/test/tester.php


This post was edited by Azrad on Jan 6 2013 07:57pm
Member
Posts: 31,187
Joined: Aug 31 2008
Gold: 28,306.50
Trader: Trusted
Jan 6 2013 08:42pm
Quote (Azrad @ Jan 6 2013 07:54pm)
relative path: I call you on the phone and tell you to take walk 100 yards north, and 30 yards east.
absolute path: I call you on the phone and tell you to go to 1313 Elm Street.

The relative path is the path based on your current location (and will only work from that location, if I had called someone at a different location and told them to go 100m north, 30m east; they would end up the wrong spot), the absolute path will work no matter where you are.

Code
Your current "location" is http://stungeye.com/school/
The root of the current "location" is http://stungeye.com/

given the instructions "/test/tester.php" (#2), it means erase everything but the root of the path, and then append, so the absolute path is: http://stungeye.com/test/tester.php

given the instruction "test/tester.php" (#3), it means just append that to the end of your current location, so the absolute path is: http://stungeye.com/school/test/tester.php


:wub: thanks.
Member
Posts: 1,875
Joined: Sep 1 2006
Gold: 35.76
Jan 9 2013 11:58am
Quote (Azrad @ Jan 6 2013 09:54pm)
relative path: I call you on the phone and tell you to take walk 100 yards north, and 30 yards east.
absolute path: I call you on the phone and tell you to go to 1313 Elm Street.

The relative path is the path based on your current location (and will only work from that location, if I had called someone at a different location and told them to go 100m north, 30m east; they would end up the wrong spot), the absolute path will work no matter where you are.

Code
Your current "location" is http://stungeye.com/school/
The root of the current "location" is http://stungeye.com/

given the instructions "/test/tester.php" (#2), it means erase everything but the root of the path, and then append, so the absolute path is: http://stungeye.com/test/tester.php

given the instruction "test/tester.php" (#3), it means just append that to the end of your current location, so the absolute path is: http://stungeye.com/school/test/tester.php


I really liked your anallogy on that!

so absolute would kinda be like an area code for a phone number?
Member
Posts: 31,187
Joined: Aug 31 2008
Gold: 28,306.50
Trader: Trusted
Jan 9 2013 12:35pm
The absolute would be the full path.

whereas the relative is the location, like o in that example, if you where the the location http://stungeye.com/school/test

then the relative path to tester is simply adding /tester.php

because its relative to your current location.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll