简体   繁体   中英

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!

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/

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') ?>

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"); ?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM