PDA

View Full Version : PHP keep included links intact



unchew
February 20th, 2007, 11:15 AM
Hi, I'm making a web page that will consist in various included php files (header, menu, footer, etc). The problem arrives when I move up or down in the directory levels.

Let's imagine my footer.php file has an image who's path is "/imgs/footer.gif". When I include the file into a file that is in the same directory(root), the image path works ok, but then when I include it in a page that is in a folder like "root/areas" the image link will not work now because when inserted it will search the image in root/areas/imgs/footer.gif instead of root/imgs/footer.gif.

Then, does someone has a work around on this issue? Some code, method or tutorial? Anything is welcomed.

deletedUser2352352
February 20th, 2007, 11:54 AM
use absolute urls instead. its a pain but it will work

evildrummer
February 20th, 2007, 12:01 PM
or keep all the files in the same folder 'root' then use mod-rewrite so it looks like your at: http://www.example.com/about/ when really your at http://www.example.com/about.html or http://www.example.com/index.php?page=about&extrastuff=2432

unchew
February 20th, 2007, 12:04 PM
mod rewrite? Can you explain how it works?