NameSilo

My own Php pages in Phpbb.

SpaceshipSpaceship
Watch

Shorty

Established Member
Impact
28
Hey all, i've hit a snag when trying to run my own php scripts using phpbb.

I'm using the standard phpbb hack to add your own pages, which is:

upload.php (in the root directory with the rest of the php pages):
Code:
<?php

define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//


//
// Output the basic page
//
$page_title = $lang['uniquetitle1'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

$template->set_filenames(array(
	'body' => 'upload.tpl')
);
make_jumpbox('viewforum.'.$phpEx);


$template->pparse('body');

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

?>

And then having upload.tpl (in templates/mytemplate). The problem is this: I can't run any php code contained in upload.tpl. HTML works fine.

I've tried removing the php tags, that doesn't work.

TheArbiter told me to add this line to my .htaccess which theoretically should mean .tpl files can run php:
AddType application/x-httpd-php .htm .html .shtml .tpl

But that hasn't worked either. Upon closer inspection of my cPanel I saw this in the MIME types:
application/x-httpd-php .php .php4 .php3 .phtml

Could that be preventing me from running .tpl as php? Any help or input would be greatly appreciated.

Thanks for reading this unneccessarily long post. :)
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
The problem is that phpbb reads and parses the template files. It doesn't include(); them.
 
0
•••
Ok, thanks for the reply Jim_, but how do I get around this? Is there an alternate way to create your own pages whilst retaining the template's header and footer?
 
0
•••
replace
Code:
$template->set_filenames(array(
	'body' => 'upload.tpl')
);
with
Code:
include("./path/to/your/file.php");
and it should work fine.
 
0
•••
Appraise.net

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomainEasy — Payment Flexibility
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back