Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Oct 2002
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Really basic stuff - please help

    I am trying to reference in an image on my site. Ok, that sounds easy. I want this image to be on every page of my site, no matter where the page is. I do not want to alter the code on every page depending upon how deeply that page is located. However, as I am using lots of images on each page, I do not want to have to use the following:

    <img src="http://www.mysite.com/images/image.gif">

    as all those DNS queries will slow me down. So here's the rub...how can I reference images relative to the root of the site, rather than the page itself? I have tried the following:

    <img src="/images/image.gif">

    expecting the first forward slash to reference the root. IT DOES NOT WORK!

    I am getting desperate - can someone please tell me what I am doing wrong? I am using MS IIS 5 on a Win2k machine, if that makes a difference.

    Cheers

    Russell

  • #2
    New Coder
    Join Date
    Oct 2002
    Location
    UK London
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    \dirName/ will take you to the root dir and then into dirName , another example.

    \include/javascript/

    would take you to the root and then into the include dir, and then into the JavaScript dir.

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by redmeat
    \dirName/ will take you to the root dir and then into dirName , another example.

    \include/javascript/

    would take you to the root and then into the include dir, and then into the JavaScript dir.
    Backslash (\) is not a valid character in html so that is not a good solution even if a certain very commonly used browser is so crass as to accept it in the place of the forward slash (/).

    What Russell is using is the correct form for the url so the fact that it isn't working suggests a different kind of problem. I would guess that his pages have a <base> tag in the head which is overriding the true base for the document and causing the malfunction of his relative urls.


  •  

    Posting Permissions

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