Relative Paths './' and '../'

  • -->gm<--
  • Beginner
  • Beginner
  • User avatar
  • Joined: 19 Mar 2004
  • Posts: 57
  • Status: Offline

Post May 7th, 2008, 12:48 pm

Hi everyone,

When using relative? paths does anyone know the difference between './' and '../' ?
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post May 7th, 2008, 12:48 pm

  • spork
  • Plastic Member
  • Silver Member
  • User avatar
  • Joined: 22 Sep 2003
  • Posts: 3500
  • Loc: Rochester, NY
  • Status: Offline

Post May 7th, 2008, 12:50 pm

. refers to the directory you're currently in
.. refers to the directory above the one you're currently in
  • -->gm<--
  • Beginner
  • Beginner
  • User avatar
  • Joined: 19 Mar 2004
  • Posts: 57
  • Status: Offline

Post May 7th, 2008, 1:14 pm

Thanks Spork,

Say in this example there isn't any difference between them?

If the webpage is in the root and the images are in an 'image' directory in the root.

  1.  
  2. <img src="images/icon_link.png" alt="" width="22" height="22" />
  3. and
  4. <img src="./images/icon_link.png" alt="" width="22" height="22" />
  5.  


Why would you bother using './'?, for include files or something?

Thanks
  • -->gm<--
  • Beginner
  • Beginner
  • User avatar
  • Joined: 19 Mar 2004
  • Posts: 57
  • Status: Offline

Post May 8th, 2008, 3:19 am

I can't find a good use for './' in included files either?
Can anyone enlighten me as to when they would use './' ?
  • joebert
  • Packaging Tape
  • Genius
  • User avatar
  • Joined: 10 Feb 2004
  • Posts: 8384
  • Loc: Clearwater, FL
  • Status: Offline

Post May 8th, 2008, 4:16 am

Maybe just an operating system relic from before there were browsers ?
  • -->gm<--
  • Beginner
  • Beginner
  • User avatar
  • Joined: 19 Mar 2004
  • Posts: 57
  • Status: Offline

Post May 8th, 2008, 5:50 am

Maybe, I don't really see a use for it..
  • spork
  • Plastic Member
  • Silver Member
  • User avatar
  • Joined: 22 Sep 2003
  • Posts: 3500
  • Loc: Rochester, NY
  • Status: Offline

Post May 8th, 2008, 6:55 pm

In older shells for UNIX/Linux systems, the dot was sometimes required in order to execute a script in the current directory. It really has no use in modern shells and is virtually unnecessary in URLs.
  • Bogey
  • Ounce of 'Zu'
  • Web Master
  • User avatar
  • Joined: 14 Jul 2005
  • Posts: 4221
  • Loc: Ozzu
  • Status: Offline

Post May 8th, 2008, 8:13 pm

-->gm<-- wrote:
Maybe, I don't really see a use for it..

I doub't you need to worry about that thing anymore. It's gotten more modern now :D
01000010 01101111 01100111 01100101 01111001
My Developing Blog (5)

Post May 8th, 2008, 10:54 pm

I still use that sometimes with my .net apps actually ... very rarely though ... something like
  1. Server.MapPath("./")

gives me the current directory on my host ... so if I want to create folders on my root I'll use it like
  1. Server.MapPath("./" & FolderName)
DAIRY!

Post Information

  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© Unmelted Enterprises 1998-2008. Driven by phpBB © 2001-2008 phpBB Group.

 
 
 
 

Need a pre-made web design for your website?

Check out our templates here: Ozzu Templates


400+ FREE Website Templates. Download Now!