MyBB Community Forums

Full Version: Show thread on website?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi everyone, I'm just wondering if its possible to show a specific thread and all posts within it on a website through a php file? I searched for website integration but all I could find was like login form integration.

Basically what I want to do is use MyBB as both a forum and a comment system on the articles that are posted on the site. But instead of just giving a link to the comments which would take you to the respective thread on the forums, I'd rather display the posts on the article page. Just wondering if this is possible and how I can go about doing that.
I can think about 3 solutions, from the easiest to the smartest (I will recommend the second):

- A simple temporary solution would be frames or iframe

- A better solution will give a link to an existed thread for every article, visitors can go to MyBB to post comments (or just copy & paste the html of the form inside your page). When an article is displayed all comments of the specified thread will be fetched through an SQL SELECT query (this will demand redesign of your own). But visitors will still be able to visit directly the thread instead of the article and see just the comment (unless you'll configure some redirect or blocking only to those viewing the thread, not adding post/comment).

- To dig in MyBB source and understand every aspect of it, then make a great integration.
If you follow examples in the User Tutorials section of the forum, then you can get website intergration. Change these settings where applicable, and put it right at the top of your scripts!

<?php
chdir('forums'); // path to MyBB
define("IN_MYBB", 1);
require './global.php';
?>

This will allow you to use MyBB functions on your webpages - such as $db->simple_select and fetch_array etc., and other functions (such as multipage, my_number_format etc.).

This way, you can use the postParser to make sure things like BBCode are parsed right on your webpages.