PHP Includes - relative Paths
Posted: Mon Dec 08, 2003 12:54 am
I've been using these include statements with php and they work great except for one slight problem. Okay, it's a big problem.
I want to make a banner that is on the top of all of my pages. So i have created a page banner.php in my include folder. Inside This page... it has a picture on it that is located in the root directory then in a images folder. So it looks like this:
<img src="images/background.jpg">
Now I want to reference this page not only on the index.php page that sits in the root directory, but also in the rest of my pages such as this.
http://www.domain.com/pages/test/file.php
But it isn't adding in the correct directory structure on it's own.
I need some way of having the include php statement automatically include the ../../../images/background.jpg on the files that need that. Just the same as any other directory that needs a reference to the banner page, where ever the current document is located.
Can anyone help me?
Thanks,
Kevin
I want to make a banner that is on the top of all of my pages. So i have created a page banner.php in my include folder. Inside This page... it has a picture on it that is located in the root directory then in a images folder. So it looks like this:
<img src="images/background.jpg">
Now I want to reference this page not only on the index.php page that sits in the root directory, but also in the rest of my pages such as this.
http://www.domain.com/pages/test/file.php
But it isn't adding in the correct directory structure on it's own.
I need some way of having the include php statement automatically include the ../../../images/background.jpg on the files that need that. Just the same as any other directory that needs a reference to the banner page, where ever the current document is located.
Can anyone help me?
Thanks,
Kevin