Page 1 of 1

Using Styles Over My Whole Site (Template System)

Posted: Wed Jan 19, 2005 11:00 am
by Ice794
I tried to post this request in the Tutorial board, but only Mods can post there.

I use phpBB for my forum, and I've decided I'm going to create my own web application using PHP and MySQL.

I want the design of my site consistant with the forum.

Basically when a user selects a theme in their profile, I want the whole site to be displayed to the user in that theme, rather than just the forum being displayed in that way.

Any help appriciated :)

Icé :cool:

Posted: Wed Jan 19, 2005 11:05 am
by feyd
The tutorials board is strictly for tutorials. No requests or anything else, as you may have figured out.

As for bringing the theme to the rest of the site, You'll need to convert (at least partly) all the pages into phpBB pages. This will give each page access to the user information and more importantly theme information and classes. Once you have this, which can take a while -- believe me, you should be able to (partly at least) switch themes site wide.

Posted: Thu Jan 20, 2005 3:47 pm
by Ice794
As for bringing the theme to the rest of the site, You'll need to convert (at least partly) all the pages into phpBB pages.
As in:

Code: Select all

define('IN_PHPBB', true);
Is that what you mean by converting the pages into phpBB pages?

Can take a while? I presume if the site is already there? I'm creating this site from scratch, so I can make the pages as phpBB pages to start with. I'm sure that will be easier than trying to convert anything.
can take a while -- believe me,
Sounds like your speaking from experience. Are you?

I'm also using the phpBB session ID's. Don't I have to make all my pages phpBB pages anyway to use the session ID's?

Icé :cool:

Posted: Thu Jan 20, 2005 3:52 pm
by feyd
yes to all, except the define.. that's a piece.. you need all of this to start with:

Code: Select all

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
//
to change which page is being show where a user is, change PAGE_INDEX, which is defined in /includes/constants.php, to your own define. Note: you will need to add any new pages to the language files so phpBB can actually say where they are.

Posted: Thu Jan 20, 2005 4:14 pm
by Ice794
So where the PAGE_INDEX is, if this piece of code was on my tutorials page, the PAGE_INDEX would be PAGE_TUTORIALS.

And the PAGE_TUTORIALS would be in the language file as something like:

Code: Select all

$langї'PAGE_TUTORIALS'] = 'Turotials';
Something like that?

Icé :cool:

Posted: Thu Jan 20, 2005 4:56 pm
by feyd
the actual matching of location to "english" is in viewonline.php around line 160. It's a large switch statement.

Posted: Thu Jan 20, 2005 6:26 pm
by Ice794
feyd wrote:the actual matching of location to "english" is in viewonline.php around line 160. It's a large switch statement.
Thanks, I've found it.

Icé :cool:

Posted: Sun Jan 23, 2005 2:27 pm
by Ice794
Ok. I started getting Session ID errors. Something about headers already being sent.

Then I deleted the file, copy and pasted the code again, and uploaded it again on friday morning and it worked fine.

Then today when I came back to it, I got the Session errors again.

Now I've deleted the file, copy and pasted the code and saved it again, and uploaded it again. Now I don't get any errors.

Could anybody tell me the problem with this?

The code I've got so far is:

Code: Select all

<?
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
	//
	define('SHOW_ONLINE', true);
	$page_title = $lang&#1111;'Index'];
	include($phpbb_root_path . 'includes/page_header.'.$phpEx);

	$template->set_filenames(array(
		'body' => 'index_body.tpl')
	);

?>

The URL for this file is http://www.sarginsons.net/forum/php.php


Also, if I place the file outside the /Forum/ directory I get an error, even if I change the $phpbb_root_path = './'; and the 'includes/page_header.'.

Could anybody help me with this.


Icé :cool:

Posted: Sun Jan 23, 2005 2:31 pm
by feyd

Posted: Sun Jan 23, 2005 3:14 pm
by Ice794
Ok, thanks a lot feyd, I've now eliminated that problem :)

I like that tutorial too. Taught me a lot that I needed to know.


If I place the file outside the Forum/ directory I get an error, even if I change the $phpbb_root_path = './'; and the 'includes/page_header.'.

Could anybody help me with this.


Icé :cool:

Posted: Sun Jan 23, 2005 3:18 pm
by feyd
are these file not founds, by the includes?

look at temporarily changing the include path (inside the script) such that the phpbb included files will work..

http://php.net/set_include_path

Posted: Sun Jan 23, 2005 3:39 pm
by Ice794
Ok, thanks. I've got it :)

You know, I really like this place. Normally places arn't as friendly. I've only spoke to a couple of members and I've already added the URL to my favs. I'll certainly be sticking around :)

Thanks again feyd.

Icé :cool: