Page 1 of 1

php include - including, but not executing

Posted: Tue Dec 07, 2010 10:07 pm
by neerav
I have followed the instructions found here in order to include a PHP file with code in the footer of my forum.

The file is successfully included. This is proven by the fact that html code and comments at the beginning and end of the include file are visible in the page source. However, none of the php output is visible.

Code: Select all

<!-- begin test include -->
<?php

print "yes, ";
echo "file included";

?>
<!-- end test include -->
The "begin" and "end" comments are in the source code. However, neither the Print or the Echo command produce any output.

I am using version 3.0.8 and the prosilver theme.

What is the obvious thing that I just can't see? :?

Re: php include - including, but not executing

Posted: Tue Dec 07, 2010 10:09 pm
by Brf
How did you include it?

Re: php include - including, but not executing

Posted: Tue Dec 07, 2010 11:04 pm
by neerav
Included as:

Code: Select all

<!-- INCLUDE ../../../test.include.php -->

Re: php include - including, but not executing

Posted: Wed Dec 08, 2010 12:06 pm
by Brf
neerav wrote:I have followed the instructions found here in order to include a PHP file
If you had followed the instructions found here, you would know you cannot include a PHP file that way. That method is only for HTML files. You would need to use INCLUDEPHP as per this tutorial: http://wiki.phpbb.com/display/MODDOCS/T ... ate+syntax

Re: php include - including, but not executing

Posted: Wed Dec 08, 2010 1:54 pm
by neerav
My previous searches were limited to the support forum. :oops: Thank you for pointing me in the right direction.

For anyone else who searches this forum, PHP includes work perfectly in phpbb version 3 templates when coded as:

Code: Select all

<!-- INCLUDEPHP test.include.php -->
relative to the ROOT directory of the phpbb forum installation.

Thank you, Brf.