View Full Version : phpBB3 Integration into Site

08-02-2008, 02:17 PM
I want to have a Login option as well as the latest posts of the forum on my site sidebar. I looked up how to do this and it seems people use Joomla or something? I don't really know, but I downloaded that and I don't get it at all. o_o

Can someone tell me, in really simple terms xD, how to accomplish what I'm trying to do?

08-02-2008, 07:15 PM
You need to use php to make calls to your forum's database.

08-02-2008, 07:34 PM
Yes, but how?

08-03-2008, 02:29 AM
I've never tried to do it with phpBB, but you basically need to have a script that handles making a connection to the database which you can include in your page code to grab the latest posts. You can make a connection with the following code:

// The $conf array holds the configuration data for the db
$conf = Array('host' => 'real_host', 'user' => 'real_username', 'pass' => 'real_password', 'db' => 'real_database');

function connect() {
return mysql_pconnect($conf['host'], $conf['user'], $conf['pass']);
And call it like this:

$con = connect();
Then when you want to make a query:

$sql = 'select * from post limit 5'; // You'll need to change this query to reflect the actual db structure.
$result = mysql_fetch_array(mysql_query($sql, $con));
echo '<pre>'; print_r($result); echo '</pre>';

Obviously you'd have to write some sort of code to deal with connection failures, but that's pretty straightforward with php.net and a bit of googling. :p

This is nowhere near as object-oriented as it should be, I think, but it's easy to code and deal with. :p

08-03-2008, 06:19 PM
Thanks Face ^.^

And I found a good tutorial for it too. :3

I think I'll just skip the login thing I wanted cos' I can't find a tutorial for that. xD

Little Blue
08-03-2008, 07:11 PM
I dunno if this is the easiest way to do it, but its the way I do it one some of my pages, and that's to fully integrate your site with the phpBB system.

This tutorial illustrates what's needed to use the phpBB system in custom pages: phpBB &bull; Add a New Custom Page to phpBB &bull; 3.0 (http://www.phpbb.com/kb/article/add-a-new-custom-page-to-phpbb/)

Then use a mod such as phpBB &bull; Modifications database (http://www.phpbb.com/mods/db/index.php?i=misc&mode=display&contrib_id=3132) as as long as you've the overall_header template on each of your custom pages you'll be able to login anywhere on your site. I'm not sure about adding it to a sidebar though, but I suppose you can use the login box html in a sidebar template and it should still work...

Hope that's of some help...