I have a header file which is used in many pages. header page has two images coded with relative path according to the index page(That's fine...!!! it works). Problem arises when header is called in different pages (which are in different tree structure) images does not display since header's image follow the same path instead of that path is suppose to be according to the page in which header is called. Please advise how to change the image path of header according to the page in which it is called.
Also i had somewhere read that relative eg.(images/logo.png) path is more wise than absolute eg.(http://example.com/images/logo.png) path from prospective of speed. What is this issue?
If you wish to keep relative paths, perhaps you can build if-else scenarios using getcwd in PHP.
http://php.net/manual/en/function.getcwd.php
You can then specify that if it's for example longer than 5 chars (like home/) then you change to file path to
../img/file.gif
in any other case you just leave it like
img/file.gif
Hope this makes sense.