How To Use PHP Includes In phpBB Template Folder
5/29/2013If trying to get php includes to work in your phpbb forums template has got you pulling out your hair, your in luck, as I already pulled all mine out for you. Here is how to use php includes in the styles/template folder >> overall_header and overall_footer files. There are many variables that all need to work together in order for them to work. They are as follows...
<!-- INCLUDEPHP ../inc/foot.php -->
- It has to read INCLUDEPHP not just INCLUDE.
- Absolute links do not work.
- PHP needs to be turned on in the ACP. General Tab >> Security Settings >> Allow php in templates >> YES
- This is what threw me for a long time. The phpBB forum is looking for the php include starting from the root of the forum install. NOT from the location of the include itself. For instance, my "inc" folder is directly off the root of my website /inc and forum/styles/prosilver/template/overall_header.php is 4 folders deep. So normally if I did a relative link inside overall_header.php file it would have to come out of 4 folders like ../../../../ But because it's looking for it from the root of the forum and not the template folder it only needs to come out of 1 folder like ../ and into my inc folder sitting directly off the root of my website root.
It really is that easy! But you may find as I did, that finding all the peices in one place is the hard part - until now that is. ;~)