# Having Trouble Including a PHP template

**URL:** <https://www.phphelp.com/t/having-trouble-including-a-php-template/9947>\
**Category:** General PHP Help\
**Created:** [May 5, 2007, 7:10am UTC](https://www.phphelp.com/t/having-trouble-including-a-php-template/9947 "2007-05-05T07:10:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![James300](https://www.phphelp.com/user_avatar/www.phphelp.com/james300/32/49_2.png) [@James300](https://www.phphelp.com/u/James300)\
**Post date:** [May 5, 2007, 7:10am UTC](https://www.phphelp.com/t/having-trouble-including-a-php-template/9947/1 "2007-05-05T07:10:42Z")

</div>

Hi,

I’m somewhat new to PHP, and am having trouble including a php template I created… basically the template (menu.tpl.php) needs to be called and placed within all pages of the site I’m working on… I’ve tried using:

\<?php include('menu.tpl.php'); ?\>

where I want the menu to appear… but nothing shows up… I know I’m missing something simple here…

Help?

---

<div class="post-metadata">

**Author:** ![Zyppora](https://www.phphelp.com/letter_avatar_proxy/v4/letter/z/76d3ee/32.png) [@Zyppora](https://www.phphelp.com/u/Zyppora)\
**Post date:** [May 5, 2007, 4:54pm UTC](https://www.phphelp.com/t/having-trouble-including-a-php-template/9947/2 "2007-05-05T16:54:09Z")

</div>

What’s the template file look like? Could you post the code here?

---

<div class="post-metadata">

**Author:** ![James300](https://www.phphelp.com/user_avatar/www.phphelp.com/james300/32/49_2.png) [@James300](https://www.phphelp.com/u/James300)\
**Post date:** [May 5, 2007, 8:57pm UTC](https://www.phphelp.com/t/having-trouble-including-a-php-template/9947/3 "2007-05-05T20:57:44Z")

</div>

I would but I’d rather get direct help… could you email me and I’ll show you the code?..

jamesfalconer AT shaw . ca

Thanks ![:)]()

---

<div class="post-metadata">

**Author:** ![kev1952](https://www.phphelp.com/letter_avatar_proxy/v4/letter/k/9fc29f/32.png) [@kev1952](https://www.phphelp.com/u/kev1952)\
**Post date:** [September 2, 2007, 4:07am UTC](https://www.phphelp.com/t/having-trouble-including-a-php-template/9947/4 "2007-09-02T04:07:47Z")

</div>

For include() to work the entire page must have a .php extension. You can’t use include() in a HTML document (as you said it doesn’t work). On my site I wanted to do the same thing so simply renamed all the files from .html to .php. Worked like a charm! ![:)]()

The page(s) doesn’t need to be all PHP but allows you to easily mix PHP and HTML. You can also pass variables to different pages very easily when you set it up as above.
