Having Trouble Including a PHP template


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…


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

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 :)

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.

Sponsor our Newsletter | Privacy Policy | Terms of Service