phpBBHacks.com - Add the phpBB Style Sheet to Any PHP Page (All Databases)
Talk sports at SportsForums.net
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
Add Us:     MySpace     Facebook     StumbleUpon
Username:    Password:
Remember Me?    
Add the phpBB Style Sheet to Any PHP Page (All Databases)
BlinkList
del.icio.us
Furl
linkaGoGo
reddit
Simpy
Mister Wong
Yahoo! My Web

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

PdV
New User

Joined: 24 Apr 2006
Posts: 1

PostPosted: April 24th 2006, 8:16 am    Post subject: Add the phpBB Style Sheet to Any PHP Page (All Databases) Reply with quote

I have installed phpBB 2 and couldn't get Closed's solution to work for me.

Whether this was due to an incompatibility with phpBB 2 or simply the setup that I had on my server, I'm not sure, but it led me to having a tinker with the code.

What I found was that Closed's solution was MySQL specific. Now, while I use MySQL as the database, it may not be the same for everyone, so I have amended the solution to work across all databases.

Simply use the following code instead:

Code:
<?php
//
// Start of stylesheet loading
//

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

# Query to execute.
$query = "SELECT * FROM ".THEMES_TABLE." WHERE themes_id = ".$userstyle;

# Run the query.
$result = $db->sql_query($query);

# Get the first (and only) row.
$row = $db->sql_fetchrow();

# Extract the style and template names.
$template_name = $db->sql_fetchfield('template_name');
$style_name = $db->sql_fetchfield('style_name');

# Output the style sheet link.
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
//
?>

This code assumes that you have installed phpBB in a sub folder called "forum". If you have it elsewhere, then you will need to amend the path after the "href=" tag.
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.it - phpBB Česky - phpBB Turkiye - phpBBArabia.com - phpBB-fr.com - Romanian phpBB online community - phpBB-TW.net - phpBBservice.nl - phpBB Brasil

Network: iFroggy Network Blog - iFroggy Hosting - SportsForums.net - KarateForums.com - YanksBlog.com - PhotoshopForums.com - DeveloperCube - Managing Online Forums - ManagingCommunities.com - CommunityAdmins.com - DrGregHouse.com - Bad Boy Blog - BadBoyForums.com - SodaRatings.com - Patrick O'Keefe

< Advertising - Contact Us - Staff - User Guidelines >

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