View Full Version : phpBB3 Integration into Site
Jojee
08-02-2008, 01: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?
rubah
08-02-2008, 06:15 PM
You need to use php to make calls to your forum's database.
Jojee
08-02-2008, 06:34 PM
Yes, but how?
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:
<?php
// 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:
<?php
$con = connect();
mysql_select_db($conf['db']);
?>
Then when you want to make a query:
<?php
$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
Jojee
08-03-2008, 05: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, 06: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 • Add a New Custom Page to phpBB • 3.0 (http://www.phpbb.com/kb/article/add-a-new-custom-page-to-phpbb/)
Then use a mod such as phpBB • 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...
Powered by vBulletin® Version 4.2.3 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.