Site integration (boards) From Online Manual

Jump to: navigation, search

Many people would like to learn to do stuff such as what is done at and other SMF sites where the content is loaded even on non SMF pages.

Have you ever seen a website that includes information taken directly from an SMF powered forum? Many people have use for including information from their forum on to their website, and thus use integration between their website and forum to help make the user feel well connected. An example can be found directly at the Simple Machines website, which uses the site's top menu inside the forum and extracts the latest news posted on the news board on the main page.

It is not difficult to accomplish this for your own website and forum with the use of SSI.php. for more information about SSI.php see

This tutorial assumes that you have some level of HTML and PHP knowledge.

From the most simplest things, up to building a whole site, SSI can be used sparingly or extensively.

Let's say you wanted to create a page that displays board information.


// Get SSI into the mix.
include_once(dirname(dirname(__FILE__)) . '/Demo/SSI.php');

// What boards do we want to load?
$myboards = array(1, 2, 3);

// This is simple.. For each board, load the info and remove the junk.
foreach ($myboards as $board)
// With $board set as the current board this function will use it to load the board.

// If we got nothing it must be an error.
if (empty($board_info))
die('Hey, ' . $board . ' is empty');

// Clean up and only use the stuff we want.
$context['boards'][$board] = array(
'id' => $board_info['id'],
'name' => $board_info['name'],
'description' => $board_info['description'],
'moderators' => array(),

// Moderators contain too much junk. We can fix this.
if (!empty($board_info['moderators']))
foreach ($board_info['moderators'] as $temp_mod)
$context['boards'][$board]['moderators'][] = $temp_mod['name'];

// Get rid of the unnecessary.
unset($myboards, $board_info);

// Header..
echo '
<title>Test Document</title>
<table border="1">';

// Now we output.
foreach ($context['boards'] as $b)
echo '
<td colspan="3">', $b['name'], '</td>
<td>', $b['description'], '</td>
<td>', implode(', ', $b['moderators']), '</td>

// Echo footer.
echo '


This script would output board information from boards with IDs of 1, 2 and 3. So we get something like:

General Discussion
   Description    Feel free to talk about anything and everything in this board.
FAQ Discussion
   Description    FAQ Discussion
   Moderators    test

And our board Information is now on another page on our site but not within SMF visibly.

Thus allowing you to put your site information where ever you want it on your site. The script is very well commented and easy to follow and should work as long as the path to SSI.php is changed to your own path and you change the boards you wish to use. This is just an example file. More functionality can be done and more information can be included. The best way to get information would be to add a little script to output what information is possible to get from each board. So we find in the script:

 // Moderators contain to much junk. We can fix this
foreach($board_info['moderators'] as $temp_mod)
$context['boards'][$board]['moderators'][] = $temp_mod['name'];

and after it add:

 echo '<pre>';
echo '</pre>';

This now is outputting a whole bunch of information that is possible to use. Following the correct array you can correctly include information into your site that even this script does not yet handle.