Add PHP Code To Your phpBB Forum Templates

Editing a phpBB template can be rather exasperating because you don’t have freedom to add dynamic code. In fact, if you do add php code to your template, you will find that it won’t be recognized. So what do you do?

Step 1: Enable PHP Code In Templates

The first step to adding PHP code is to enable PHP and INCLUDEPHP statements in your template.phpBB Security Settings By default, these statements are disabled because they can pose a significant security risk. So to allow the use of PHP, you will need to change your security settings.

To do this, login to the administration control panel. And then, under the general tab, scroll down to the bottom of the page and click on Security settings under the Server Configuration subheading, as shown in the image.

Next, towards the bottom of the Security Settings page, you will see the setting that we are looking for: Allow php in templates. Select "Yes" as shown below.

phpBB Allow PHP in Templates 

Step 2: Add PHP to Your Template

Now, to add PHP to your template, simple enclose your PHP code within special PHP template tags. For example, if you wanted to use the echo function, your code might look something like the following:

<!-- PHP --> echo "Hello World!"; <!-- ENDPHP -->

Similarly, if you wanted to include an external file, your code might look like this:

<!-- PHP --> include("externalFile.php"); <!-- ENDPHP -->

And that’s it! Adding PHP code to phpBB templates is easy.

Troubleshooting Potential Problems

  1. Changes aren’t showing up. If your changes aren’t showing up, be sure to purge the phpBB cache. This can be done directly from the initial General page or under the Styles tab.
  2. Cache is cleared, still no change. If you are including external files, be sure that you have linked to the proper location. We suggest using absolute file paths.

More problems? Let us know.

Tags: , , , ,

5 Responses to “Add PHP Code To Your phpBB Forum Templates”

  • On January 3, 2009 at 7:10 pm,Forsaken@Domain Marvelous | Domain Name Information | wrote:

    I had used PHPBB as a forum board solution for my previous forums. It is one of the most flexible board solutions available in terms of modifications and I love it. Mods (or modifications) also come with easy instructions as to where to place or replace the codes in order to install the plugins.

  • On January 3, 2009 at 7:45 pm,Velvet Blues wrote:

    Yes, phpBB is my favorite forum software and has almost as great a user community as WordPress, which supplies the bulk of the Mods.

  • On December 11, 2009 at 8:25 am,toufeeq wrote:

    how will get value of template form in smarty

  • On December 11, 2009 at 8:29 am,toufeeq wrote:

    how to get a value of tpl form

  • On March 12, 2011 at 3:56 pm,Barnamah wrote:

    thank you very much. I was looking for this everywhere. but you made it very clear.

Trackbacks

Trackback URL for this entry:
http://www.velvetblues.com/web-development-blog/add-php-code-to-your-phpbb-forum-templates/trackback/

Leave a Reply

Want us to work on your project?

Contact us today for a quote. Click here to submit details regarding your project.

If you are making a general inquiry, send an email to info@velvetblues.com