Accessing PHPBB3 from Drupal

Events happening in the community are now at Drupal community events on www.drupal.org.
staylor's picture

I'm a relative newbie into Drupal usage.

I have Drupal running and have Phpbb3 installed and accessing it from Drupal using the arkepp phpbb module (and very good it is too).

Im now trying to understand how best to display forum content along with Drupal content. Currently it spawns a new window with no Drupal "screen furniture".
Ive read the Travis Tidwell post about using XMLRPC and the Services module - which whilst understandable seems to be perhaps more complex an approach than i want to tackle.
Whats the simple way of a setting up a menu link to have the forum appear in the content section of a Drupal page.

Thanks for your help

Simon

Comments

Workaround

arkepp's picture

This question pops up on a regular basis. Because PHP doesn't support namespaces, there is no elegant way of including phpBB inside Drupal. There are three complete solutions that I can think of

1) Prefix all classes, function and global variables in one application, so that there is no overlap. Use "include" and tweak phpBBs templating system to omit headers etc.

2) Use curl or something similar to fetch the HTML output by phpBB. Include this output in Drupal. This creates overhead, because Drupal will send an HTTP request to your own server, and you need to write a bit of code so that curl uses the right cookies etc. when talking to phpBB.

3) Use an iframe. Use mod_rewrite to redirect the people who end up on the page outside the frame. This is easy, but a poor solution because of search engines and the fact that users will have no direct URLs in their address bars.

I don't like the last one. I have implemented 1) and 2) for testing purposes, and they're doable, but require a lot of effort and/or understanding of your server setup.

So the workaround I usually opt for ( see http://linux1.no and http://linux1.no/forum ) is
4) Create a similar theme for phpBB. If you need Drupal content in phpBB, use phpBB3/includes/functions.php to fetch the data from the Drupal tables and store it in a variable that the phpBB template can use.

Any others?

ok thanks very much - got it

staylor's picture

ok thanks very much - got it working in an iframe for now - i'll look at customising templates down the line

Simon

further documentation?

krisbfunk's picture

can someone direct me to further documentation on method #1 & 2?

Not really, there's not much

arkepp's picture

Not really, there's not much theory behind it
1) Whenever you see "$" after the keyword global, replace it with "$phpbb_". Do the same with class definitions. That will break a load of things, figure out what variables are pointing into midair and fix them.

2) Is not used much in PHP because a lot of webhosts don't allow the scripts running on their servers to contact external resources, so it may be not be very useful for you. But the idea is that it looks something like this
1) Webbrowser makes request for phpbb/viewtopic.php to Drupal.
2) Drupal sees viewtopic.php doesn't exist, delegates request to phpBB module.
3) Module snaps up the request URI and any cookies provided by the browser
4) libcURL is given the same information and mimics the request to the actual phpBB server / directory
5) phpBB does its thing, answering a request from the webserver
6) libcURL gets the response back
7) Module cuts away header information and other useless stuff, inserts it into Drupal page
8) Webbrowser gets a single Drupal page back from webserver

cool

krisbfunk's picture

"That will break a load of things, figure out what variables are pointing into midair and fix them."
hehehe, sounds like a blast! may go that route.. if all else fails, then theming the headers and footers is probably the next bet.

sounds like you've jumped into #2.. thanks for the info breakdown, much appreciated.

do you see any use in travis tidwells phpbb2/drupal solution transferring over to phpbb3/drupal5 using XML-RPC & the services module?

i still have to find a gallery solution to replace Full Album Pack and resolve the mess of albumimg tags left behind.. i expect that to take equally as long so theming may take the forefront if the other ways are time consuming. mind you, i do see the integration issue as much higher of a priority for ease of use and the path of least confusion (for the end-user).

is theming phpbb similar to your drupal theme the route you went with http://drupal.i1media.no ?

Hadn't seen Travis' trick

arkepp's picture

I hadn't really seen travis' trick until you mentioned it, for reference it's here: http://drupal.org/node/44977#comment-265968

It's pretty similar to what I propose to do with cURL (or any other code that pulls information from URLs, include() may also work), though I would try to not modify phpBB at all if I was using such a proxy. I guess it's just a matter of using what you know best, he didn't modify phpBB much either.

http://drupal.i1media.no/ has some minor changes in the CSS and tags to make it look like the Drupal theme.

If the Drupal theme is good it usually takes me less than 2 hours to convert a theme, which is also why I am not terribly motivated to do the complete integration. Only reason I see for it is if you want any blocks from Drupal, and you don't feel like replicating the necessary code in phpBB.

no pparse routine in phpbb3

krisbfunk's picture

travis' trick looks like an easy implementation for phpbb2, but since phpbb3 has no pparse routine like the one he has listed, i'm unsure how to handle the $content portion in template.php

phpbb

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week