include() file path question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
me!
Forum Contributor
Posts: 133
Joined: Sat Nov 04, 2006 8:45 pm

include() file path question

Post by me! »

Hi all,

I have a question on how to include files in different dir.

I have a header and footer file that is in the root dir. along with 90% of my other content. When any of those pages call the header and footer no problem.... But when a page from a sub dir. calls the includes no go???

How do I call the include?


root/header.php
root/footer.php

root/any_dir/some_file.php = :(

root/some_file.php = :)
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Could use an absolute or relative path.

include '/home/user/public_html/header.php';
include '../header.php';
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply