Link to home
Start Free TrialLog in
Avatar of beneke
beneke

asked on

path to a graphic.....

I have created a 500 error page that gets called whenever the error occur. As usual it can be called from ANYWHERE on my webpage. The only proble I have is that I would like to display a graphic on this page but because the page being called from any place make it difficult to point the path to the graphic.

I don't want to use the full refference to the site everytime like http://www.abc.co.za/images/abc.gif

Is there any other way to make this reference dynamic?
Avatar of DoppyNL
DoppyNL

You can remove the domain from the url:

/images/abc.gif

If you're still in the same domain that will still work.

Otherwise you could write some code that would determine it's current location in relation to the images and build a relative url to the image.
I wouldn't write this code, only because the chance on an error on your site increases (more code, bigger chance for errors).

In short, why bother...
/images/abc.gif
works perfectly, isn't too long, and nobody would notice the way you are refering to the image. (unless they peak in the source ofcourse).
Avatar of beneke

ASKER

Hi DopyNL,

If the error page get called from the root the above image calling will work (image/abc.gif) Calling it from another directory(CGI) the above would not be true anymore and the image would not display. Now I need to change the reff to the image to ../image/abc.gif

ASKER CERTIFIED SOLUTION
Avatar of DoppyNL
DoppyNL

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Doppy's "Relative #2" is also referred to as "root-relative".
>> Doppy's "Relative #2" is also referred to as "root-relative".

Cool, it has a name :)    ;)

And yet another thing learned... :)
Avatar of beneke

ASKER

Hi DopyNL,

Your third option, "root-relative" did the thing for me. Thanks a lot!

Regards