Solved

path to a graphic.....

Posted on 2003-11-03
6
193 Views
Last Modified: 2010-04-06
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?
0
Comment
Question by:beneke
  • 3
  • 2
6 Comments
 
LVL 6

Expert Comment

by:DoppyNL
Comment Utility
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).
0
 

Author Comment

by:beneke
Comment Utility
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

0
 
LVL 6

Accepted Solution

by:
DoppyNL earned 250 total points
Comment Utility
There are several ways to point to a file on a webserver:

1. absolute - "http://www.domain.tld/path/file.ext"
wich works allways

2. relative 1 - "../../path/file.ext"
relative to the current path; 2 down, 1 up ("path") the file "file.ext"

3. relative 2 - "/path/file.ext"
note the extra / in front!
that first / means that the path starts in the root of the domein --> actually "http://www.domain.tld" is put in front of it.
so, that should also work, even from your cgi-bin

remember that you are refering to files on the domain, not on the local filesystem (give it a try).
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 11

Expert Comment

by:Zontar
Comment Utility
Doppy's "Relative #2" is also referred to as "root-relative".
0
 
LVL 6

Expert Comment

by:DoppyNL
Comment Utility
>> Doppy's "Relative #2" is also referred to as "root-relative".

Cool, it has a name :)    ;)

And yet another thing learned... :)
0
 

Author Comment

by:beneke
Comment Utility
Hi DopyNL,

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

Regards
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now