After about a year of putting it off i finally decided i would take the plunge and try and get it to work standalone. After doing it, it took about 30 minutes, im really annoyed i didnt do it earlier.
Here is how to do it, it should take you about 10 minutes.
Firstly for convenience sake, you need to get the related classes together.
These are template (includes/template.php) and template_compile(includes/functions_template.php).
Take both of these classes and put them into a single file (template.php). Make sure that you don't include the:
Code: Select all
if (!defined('IN_PHPBB'))
{
exit;
}
Once these classes are together you need to make 2 changes to the code.
First find:
Code: Select all
$this->files_template[$handle] = $user->theme['template_id'];
Finally find:
Code: Select all
phpbb_chmod($filename, CHMOD_WRITE);
and replace it withimkingdavid wrote:in 3.0.6. Here's the line you should be looking for:Code: Select all
phpbb_chmod($filename, CHMOD_READ | CHMOD_WRITE);
Code: Select all
//phpbb_chmod($filename, CHMOD_WRITE);
chmod($filename, 0777);
index.php:
Code: Select all
include('classes/Template.php');
$template = new Template();
$template->set_custom_template('templates', 'default'); //this is important as it states where the template files are located
$template->assign_var('TITLE', 'Standalone phpBB Template Class');
$template->set_filenames(array(
'body' => 'index_body.html'
));
$template->display('body');
The template files in my example are held in a folder named 'templates'. The directory structure for my little example is as follows.
Code: Select all
/index.php
/classes/
/cache/
template.php
/templates/
index_body.html
site_header.html
site_footer.html
and my index_body.html looks like this:
Code: Select all
<!-- INCLUDE site_header.html -->
<h1>{TITLE}</h1>
<!-- INCLUDE site_footer.html -->
I hope some one finds this useful.