php include - including, but not executing

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Ideas Centre
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
Locked
User avatar
neerav
Registered User
Posts: 8
Joined: Sun Jul 30, 2006 12:21 pm

php include - including, but not executing

Post by neerav » Tue Dec 07, 2010 10:07 pm

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? :?
--
Neerav

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51785
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: php include - including, but not executing

Post by Brf » Tue Dec 07, 2010 10:09 pm

How did you include it?

User avatar
neerav
Registered User
Posts: 8
Joined: Sun Jul 30, 2006 12:21 pm

Re: php include - including, but not executing

Post by neerav » Tue Dec 07, 2010 11:04 pm

Included as:

Code: Select all

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

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51785
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: php include - including, but not executing

Post by Brf » Wed Dec 08, 2010 12:06 pm

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

User avatar
neerav
Registered User
Posts: 8
Joined: Sun Jul 30, 2006 12:21 pm

Re: php include - including, but not executing

Post by neerav » Wed Dec 08, 2010 1:54 pm

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.
--
Neerav

Locked

Return to “[3.0.x] Support Forum”