SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Knowledge is key 2 progression Tryst's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Paths and Slashes

    Hi all,

    If I have a folder in my server root directory (the folder holds images) and the URL to these images in a databases table, shall the URL (contained in the database) begin with a '/' (ie /images/pic.jpg), or should I not contain the slash (ie images/pic/jpg)?

    What are the reasons for having and not having the slash at the start of the path? Also, will the slashes need to be different also MS and Unix servers?

    Cheers all

    Tryst

  2. #2
    Can we go to a 48 hour day?
    Join Date
    May 2002
    Location
    MI
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the beginning / is if you want to reference the path from the web root. Let's say that your images are in the folder mainsite/images/img1.gif. You could on any page find this image by linking it like this:
    /mainsite/images/img1.gif

    Now let's assume the file we are linking this image form is in a folder called admin/files/file1.php
    if we didn't use the / at the start we would have to link the image like so:
    ../../mainsite/images/img1.gif.
    mitechie.com
    "Techies just think a little differently
    ...at least that is what they keep telling me."

  3. #3
    Knowledge is key 2 progression Tryst's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ahh, I got you.

    Cheers

    Tryst


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •