How To Use eXtreme Styles on non phpBB Pages

Tutorials for <a href="http://www.phpbbstyles.com/viewtopic.php?t=356">eXtreme Styles mod</a> for phpBB 2.0.

Moderator: Moderators

How To Use eXtreme Styles on non phpBB Pages

Postby pentapenguin on Fri Apr 22, 2005 4:38 pm

Hello.
This post will explain how to get the eXtreme Styles template system working on non phpBB pages.
Important note: the XS system wasn't designed to be used outside of phpBB, so this is experimental and all features may not work.

Here's a step by step how to.
1. Open template.php with a text editor.
Find:
[code start=433]$sub_templates_cfg = @phpbb_realpath($this->root . '/sub_templates.cfg');[/code]
Replace with:
[code start=433]$sub_templates_cfg = @realpath($this->root . '/sub_templates.cfg');[/code]

Find:
[code start=596]$real_root = @phpbb_realpath($this->root);[/code]
Replace with:
[code start=596]$real_root = @realpath($this->root);[/code]

Find:
[code start=2117]$php = append_sid($phpEx);[/code]
Replace with:
[code start=2117]$php = '.php';[/code]

Find:
[code start=2129]$this->vars['LANG'] = $board_config['default_lang'];[/code]
Replace with:
[code start=2129]$this->vars['LANG'] = 'english';[/code]

2. Create a includes/ directory in your root path and put the template.php file there.

3. Create a templates/ directory in your root path and put all your .tpl files inside.

4. Create a cache/ directory in your root path. (It's for the cached copies of .tpl files created by XS.)
Your final directory structure should look like this:
root/
includes/
template.php
templates/
yourtemplate.tpl
cache/

5. CHMOD the cache directory to 777 for UNIX and Linux servers.

6. Now you're ready to use the XS system.
I'm attaching a test.php page and a test.tpl so you can easily test the system.

test.php
[code filename="test.php"]
<?php
include('includes/template.php');
$template = new Template;

$template->set_filenames(array(
'body' => 'templates/test.tpl',
));

$template->assign_vars(array(
'TEST' => 'Hello, this is a test of the eXtreme Styles template system!',
));

for ($i = 1; $i <= 10; $i++)
{
$template->assign_block_vars('loop_test', array(
'I' => $i,
));
}

$template->pparse('body');
?>
[/code]
templates/test.tpl :
[code filename="test.tpl"]
{TEST} <br />

<br />
<?php
echo 'You can use PHP too. The time is ' . date('D M d, Y g:i a');
?>
<br />
<br />

<!-- BEGIN loop_test -->
{loop_test.I}<br>
<!-- END loop_test -->
[/code]

7. If you use this, please add a link back to phpBBStyles.com if you don't mind. ;)
You can use this sample HTML:
Code: Select all
<a href="http://www.phpbbstyles.com" target="_blank">Template powered by phpBBStyles.com</a>

For more information, be sure to read the eXtreme Styles MOD Tutorials and the phpBB Template Tutorial article.

Enjoy! :)
Last edited by pentapenguin on Mon Apr 25, 2005 3:51 pm, edited 2 times in total.
User avatar
pentapenguin
Moderator
Moderator
 
Posts: 1466
Joined: Tue Sep 14, 2004 4:15 pm
Location: Georgia, USA

Postby baz-x on Fri Apr 22, 2005 7:19 pm

I guess
Find:
[code start="596"]$real_root = @realpath($this->root); [/code]

should be
[code start="596"]$real_root = @phpbb_realpath($this->root); [/code]?
Regards
baz-x [blog] [website]
current projects:
» [span style="color: darkgreen"]Mex[/span] [span style="color: darkred"][ 75% ][/span]
» Nickpage Mod 2.0.0 ME [span style="color: red"][ paused ][/span]
» Style Demo Mod 1.2.2 ME [span style="color: red"][ paused ][/span]
User avatar
baz-x
Moderator
Moderator
 
Posts: 706
Joined: Sun Aug 15, 2004 9:12 pm
Location: Cache Management of Mex

Postby pentapenguin on Sat Apr 23, 2005 3:14 pm

Correct baz-x, I guess I should fire my proofreader (oh...that'd be me ;) ).
User avatar
pentapenguin
Moderator
Moderator
 
Posts: 1466
Joined: Tue Sep 14, 2004 4:15 pm
Location: Georgia, USA

.

Postby s34n on Sat Apr 23, 2005 5:05 pm

hi there, ive tried this but i cant get it to work.

im looking to include the MorpheusX nav. system into external php pages.

you said... put template.php into 'includes' do i have to replace the other 1?

ive also put the test.php file into root, and test.tpl file into 'templates' and a random html file into 'templates' but all i get is the contents of the html file within the php file.


im not totally sure how its mean't to work and how i can use this to include the morpheusX template into my website :cry:
s34n
Registered User
Registered User
 
Posts: 6
Joined: Thu Apr 21, 2005 2:04 pm

Postby pentapenguin on Sat Apr 23, 2005 5:40 pm

This tutorial is for including the XS template system--i.e. using loops, switches, etc. in your own template files.
It sounds like you want to make a page that looks like your phpBB site, if so, use this code:
Code: Select all
<?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
//

//
// Start output of page
//
$page_title = "www.your-url.com";
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
?>

<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<th class="catHead" height="25">
<b>Title Goes Here</b></th>
</tr>
<tr>
<td class="row1" align="center">
<span class="genmed">
Content goes here.
<br>

</span>
</td>
</tr>
</table>

<?php
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
User avatar
pentapenguin
Moderator
Moderator
 
Posts: 1466
Joined: Tue Sep 14, 2004 4:15 pm
Location: Georgia, USA

.

Postby s34n on Sat Apr 23, 2005 6:50 pm

many thanks!

in fact im trying to do kinda both.

I wanted the overall header and footer, and the XS Nav. menu of a seperate php page (like the one you kindly listed above).

its just adding the XS Nav. menu to that page, im pretty sure im in the right forum for this, but correct me if im wrong.

here is the example page: http://www.ddrheaven.com/test.php (ignore the session errors, not sure why they are there :roll: )
s34n
Registered User
Registered User
 
Posts: 6
Joined: Thu Apr 21, 2005 2:04 pm

Postby baz-x on Sat Apr 23, 2005 8:21 pm

the session errors might be because you have empty rows before the first <?php in your file.
Regards
baz-x [blog] [website]
current projects:
» [span style="color: darkgreen"]Mex[/span] [span style="color: darkred"][ 75% ][/span]
» Nickpage Mod 2.0.0 ME [span style="color: red"][ paused ][/span]
» Style Demo Mod 1.2.2 ME [span style="color: red"][ paused ][/span]
User avatar
baz-x
Moderator
Moderator
 
Posts: 706
Joined: Sun Aug 15, 2004 9:12 pm
Location: Cache Management of Mex

Postby Greg on Sat Apr 23, 2005 9:39 pm

Great Post Penta, will be trying this out.

Greg
User avatar
Greg
Registered User
Registered User
 
Posts: 651
Joined: Wed Jul 07, 2004 3:20 pm
Location: Yorkshire, United Kingdom

Postby pentapenguin on Sat Apr 23, 2005 10:02 pm

s34n, see Greg's excellent post here on fixing the HTML for your page so the footer isn't all messed up.
User avatar
pentapenguin
Moderator
Moderator
 
Posts: 1466
Joined: Tue Sep 14, 2004 4:15 pm
Location: Georgia, USA

.

Postby s34n on Sun Apr 24, 2005 4:16 pm

wow :o
i had that header trouble for a week using mx-system, but mx-forums couldn't figure out what was causing it, and it turned out to be a space before <?php!
so many thanks to you!

and thanks greg for that tutorial, it has fixed that issue on my main forum, but not on the test page (http://www.ddrheaven.com/test.php - im not sure why, isnt it using the same template?)

i think ill play around with inclusion of XS Nav. menu using this thread's info. im sure im missing some understanding somewhere, im sure itll get there :)
s34n
Registered User
Registered User
 
Posts: 6
Joined: Thu Apr 21, 2005 2:04 pm

Postby Greg on Sun Apr 24, 2005 7:57 pm

In test.php

Instead of

Code: Select all
   'body' => 'templates/test.html',


It should be
Code: Select all

   'body' => 'templates/test.tpl',


You can use .html but when you made the test template you named it .tpl not .html
Just a small mistake :D

Greg
User avatar
Greg
Registered User
Registered User
 
Posts: 651
Joined: Wed Jul 07, 2004 3:20 pm
Location: Yorkshire, United Kingdom

Postby rshogg on Mon Apr 25, 2005 3:43 am

Hello,

Has anyone seen a mod like this that allows you to create new pages w/in the phpBB2 folder in the ACP? I would love to be able to create my own pages within phpBB2 without having to ftp them...I can only ftp from home, and would like to play at work...

Ryan
User avatar
rshogg
Registered User
Registered User
 
Posts: 18
Joined: Tue Apr 19, 2005 6:16 pm
Location: Colorado, USA

Postby pentapenguin on Mon Apr 25, 2005 3:53 pm

Thanks Greg--I was actually using .html on my site instead of .tpl and forgot to change that....

rshogg, I haven't seen a MOD like that but IMHO it would be a super addition to XS.
User avatar
pentapenguin
Moderator
Moderator
 
Posts: 1466
Joined: Tue Sep 14, 2004 4:15 pm
Location: Georgia, USA

Postby y0y0 on Tue May 17, 2005 12:14 pm

hello,

there is something which I dont understand. Well, I installed ( viewtopic.php?t=356 ) eXtreme Styles mod 2.2.1 to get the loading faster (it's loading faster now after installing the mod).

Well, I replaced all the files in the root folder of the mod and then chmoded cache to 777. So that's all for installing eXtreme Styles mod 2.2.1 ?

And what is this tutorial for? I thought the template.php is modifited after replacing that template.php in the root folder of the mod.

So I made that test.php and test.tpl but I get

Fatal error: Call to undefined function: append_sid() in /home/www/web/html/includes/template.php on line 2117

For what is this tutorial? Installing the eXtreme Styles mod 2.2.1 is all, isn't it? Or do I need to do extra modifications like this tutorial?

greetz
y0y0
Registered User
Registered User
 
Posts: 23
Joined: Tue May 17, 2005 11:57 am

Postby pentapenguin on Tue May 17, 2005 6:57 pm

This is for using XS with your own personal site--it has nothing to do with phpBB related stuff.
If you're not making your own pages, don't modify the template.php file.
User avatar
pentapenguin
Moderator
Moderator
 
Posts: 1466
Joined: Tue Sep 14, 2004 4:15 pm
Location: Georgia, USA

Next

Return to eXtreme Styles mod tutorials

Who is online

Users browsing this forum: No registered users and 1 guest

cron