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
PHP Includes - relative Paths
Moderator: General Moderators
-
faithfulman
- Forum Newbie
- Posts: 2
- Joined: Mon Dec 08, 2003 12:54 am
-
faithfulman
- Forum Newbie
- Posts: 2
- Joined: Mon Dec 08, 2003 12:54 am
What??
Because if I have a include statement that is in the root directory/include folder. and it makes reference to images/background.jpg
and I have another file that uses that include file such as a file located at pages/category1/test/page3.php
it willl look in pages/category1/test/images/background.jpg
and I want it to look back into the roo directory/images/background.jpg
Does anyone have a solution for me?
and I have another file that uses that include file such as a file located at pages/category1/test/page3.php
it willl look in pages/category1/test/images/background.jpg
and I want it to look back into the roo directory/images/background.jpg
Does anyone have a solution for me?
- dull1554
- Forum Regular
- Posts: 680
- Joined: Sat Nov 22, 2003 11:26 am
- Location: 42:21:35.359N, 76:02:20.688W
or you could just do a http://blah.com/images/background.jpg