News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Showing a board via SSI

Started by ripla, October 03, 2009, 06:32:43 AM

Previous topic - Next topic

ripla

Hi.

I'm currently trying using SMF as a completely external forum and it has now integration with the main site. Now I would like to show one board from the forums (Feedback) and all its topics in one section of the main site. The user should be able to view and post topics / messages. I'm going to modify it quite a bit and make some the functionality myself, but it shouldn't be too difficult.

I started by reading about SSI, and the template system in general. I had some initial difficulties finding out just how to display the boards, but this is the direction I'm going:

<?php
error_reporting
(E_ALL);
// Theme we're going to use
$ssi_theme 9;
// Layers we're going to use
$ssi_layers = array('site');
// Enable GZip compression (saves bandwidth)
$ssi_gzip true;

require_once(
'foo/SSI.php');

$board 10;

loadBoard();

require_once(
'foo/Sources/MessageIndex.php');

MessageIndex();

showboard(); // this function is the main template function from MessageIndex.template.php


ssi_shutdown();
?>



My question is, am I going in the right direction with this, or is there an easier way to accomplish what I want?

Arantor

That's the quickest way of doing it, IMO. I can't think of a cleaner or shorter way, since the only alternatives in SSI itself (e.g. ssi_boardNews) don't seem to be what you're after.

suprvibes

Hi, im currently doing something like this but im having a few problems with user permissions (forum prems)
im guessing that the problem im having is due to the fact im calling loadboard() after including SSI.php which would mean loadPermissions() is called before loadboard() would this be the problem? any ideas ppl?

Arantor

Yes, loadPermissions() would need to be called first if there are any permissions related to the board, i.e. it's not visible to all people.

suprvibes

Thanks for the prompt reply :D, I got around it by adding a if statment to SSI.php to load the board if a variable I can toggle before including SSI is set.

Arantor

Interesting approach. I'm curious as to what exactly you did.

suprvibes

in the calling file i added

<?php
$loadBoard 3;
include_once($Settings['forum']['basePath'] . '/SSI.php');


then in SSI.php I added


<?php
if(!empty($loadBoard))
{
          
loadBoard($loadBoard);
}


Just below the loadUserSettings(); (same as whats done in index.php)

Arantor

Sounds good. Be *very* careful about using a variable called $settings (or $Settings) since SMF also has a variable called $settings.

suprvibes

Yeh i noticed that hehe but i was lucky i coded my sites settings with a cap S and smf uses lowercase s or i would of been screwed intergating smf lol

ripla

Thanks for the reply. I'm lucky I don't have to mess around with permissions, because everything I show in the main site is for guests.

I do have a small problem though. For some reason, while everything else seems to display fine, the "New Topic" tabs aren't rendered at all. Might this have something to do with permissions or the theme_show_buttons() function from MessageIndex.template? If I access the board directly the tabs display fine.

Arantor

Are you logged in at the time you're doing this?

Also, are there any other buttons being populated?

ripla

No  other buttons should be populated. I  tried adding loadUserSettings() and loadPermissions(), but to no avail.

Not logged in:
integration site -> no button
forum -> post new topic button

Logged in:
integration site -> all the buttons
forum -> all the buttons

Arantor

I'm not sure what is working and what isn't. Can we have a link and an accout for your site please?

Advertisement: