Yesterday
Yesterday

Reputation: 561

How is it possible to include a php file in the header of a phpbb3 html file?

I am trying to include the header of my website in the header of the phpbb3 html file using

<!-- INCLUDEPHP ../../../../header.inc -->

I am using an inc file which doesn't work, it works when I use

<!-- INCLUDE ../../../../header.inc -->

but the php doesn't. I have also tried creating a php file called header.php which has the line

<?php include("header.inc"); ?>

but this does nothing! How can I get this to work!

Upvotes: 1

Views: 3339

Answers (3)

Burfelt
Burfelt

Reputation: 73

You need to login to the administration of your PHPBB3 board and Enable PHP Code In Templates

Once this is done, you are able to execute php in the html template files by using the following code:

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

Please see this blog post for more information about using PHP in PHPBB HTML templates. http://www.velvetblues.com/web-development-blog/add-php-code-to-your-phpbb-forum-templates/

Upvotes: 4

MattP
MattP

Reputation: 2863

No, you cannot include a php file in a html file (.html extension) unless you give the file a .php extension.

If your file is called header.php then you can use

<?php include("header.inc"); ?>

Just make sure the path is correct, maybe:

<?php include("../../../../header.inc"); ?>

Upvotes: -1

Kyle
Kyle

Reputation: 22268

You need to use an absolute path

<?php include('/home/usr_name/www/includes/inc/header.inc') ?>

or a relative path

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

Upvotes: 0

Related Questions