phpBBHacks.com - Add the phpBB Style Sheet to Any PHP Page
Managing Online Forums, a manual for the community admin
StatsForums Home   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in
FAQFAQ   SearchSearch   MemberlistMemberlist   TutorialsTutorials   ContactContact Us
Username:    Password:
Remember Me?    
   I Lost My Password!
Bookmark and Share
Post new topic   Reply to topic    phpBBHacks.com Support Forums Forum Index -> phpBB 2: Integrating phpBB With Your Website
 See a User Guidelines violation? Please contact us.
Author Message

Closed
New User

Joined: 21 Dec 2002
Posts: 11

PostPosted: November 23rd 2003, 8:05 am    Post subject: Add the phpBB Style Sheet to Any PHP Page Reply with quote

Instead of just using the regular subSilver style sheet on pages, with the script below it is possible to load the style sheet used in the logged in user's chosen style.

You will need to put the following bits of code in your PHP page. If you do not have programming knowledge, this might not make much sense.

Code:
//
// Start of stylesheet loading
//

# Assign necessary stylesheet variables - if user is not logged in use default stylesheet
if ( !$userdata['session_logged_in'] )
{
$userstyle = 1;
}
else
{
$userstyle = $userdata['user_style'];
}

# Assign variable to the query so that it canbe checked by hte custom error handler
$query = "SELECT `template_name`, `style_name` FROM `phpbb_themes` WHERE `themes_id` = $userstyle";
   @mysql_query($query, $connection)
         or die("error with query: " . mysql_error() . "\n\nQuery: " . $query);
         $result = mysql_query($query);
while( $row = mysql_fetch_array($result) )   
      {
      $template_name = $row['template_name'];
      $style_name = $row['style_name'];
      }
         
echo '<link rel="stylesheet" href="/forum/templates/'.$style_name.'/'.$template_name.'.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">';

//
// End of stylesheet checking
//


Note: You will also need the below code at the top of your page:

Code:

# phpBB stuff
define('IN_PHPBB', true);
$phpbb_root_path = 'CHANGE ME';
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
//


The only line that needs to be changed is the third. Simple change the text to you forum location. Example: /forum/

Note: If you are running a Linux server you may use ../ to signal to look up one level.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    phpBBHacks.com Support Forums Forum Index -> phpBB 2: Integrating phpBB With Your Website All times are GMT - 6 Hours
Page 1 of 1
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Links: Big Message Boards - Free JavaScript - phpBB2 - phpbb styles - Suporte phpBB - phpBB Česky - phpBB Turkiye - phpBBArabia.com - phpBB-fr.com - Romanian phpBB online community - phpBB-TW.net - phpBBservice.nl - phpBB Brasil - phpBB Portugal - phpBBpersian.com

Network: iFroggy Hosting - PhotoshopForums.com - Managing Online Forums - ManagingCommunities.com - CommunityAdmins.com - KarateForums.com - Bad Boy Blog - SodaRatings.com - Patrick O'Keefe

< Advertising - Contact Us - Disclosure Policy - Staff - User Guidelines >

Copyright © 2001-2012. iFroggy Network, phpBBHacks.com. All Rights Reserved. Privacy Policy. We Support phpBBHacks.com (of course!).
Powered by phpBB © phpBB Group. phpBB SEO. We are in no way affiliated with the phpBB Group. phpBB is copyright to the phpBB Group.