# PHP Includes

**URL:** <https://forum.kirupa.com/t/php-includes/253507>\
**Category:** Uncategorized\
**Created:** [March 2, 2008, 5:31am UTC](https://forum.kirupa.com/t/php-includes/253507 "2008-03-02T05:31:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Buckycat7](https://avatars.discourse-cdn.com/v4/letter/b/50afbb/32.png) [@Buckycat7](https://forum.kirupa.com/u/Buckycat7)\
**Post date:** [March 2, 2008, 5:31am UTC](https://forum.kirupa.com/t/php-includes/253507/1 "2008-03-02T05:31:21Z")

</div>

So I’m having some trouble with the php include function, my guess is I’m just not good enough with PHP to know what I am messing up so please don’t make fun of me! 🙂

Okay here is my trouble…I’m trying to include a header and footer on every page of my site. So I’m trying to use this line of code to make this happen(with both the header and footer:

```auto

<?php include ('/header.php'); ?>

```

Now it works great with my index file in my sites home directory, but when I include it into page that isn’t in the home directory(i.e /about) it throws out an error that says there is no such file and that is failed to open. What did I miss or what do I have to make this work so the header and footer files say in one directory that I can load/include into all other pages through the site?

Also, how can I make sure that my page titles I have set up stay in place? If I include just the one header all the page titles will be the same, so how can I get around that and still have page title that are more descriptive to the page the visitor is viewing?

Thanks.
