Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: reves on August 30, 2008, 08:49:49 AM

Title: display recent threads/posts on another page/site
Post by: reves on August 30, 2008, 08:49:49 AM
Hi guys. Is there any way possible that would allow me to show on the front page of my site, an RSS feed style display of what currently active threads are going on in my forum? I know that smf outputs an rss feed, but every parser I've tried spits it out as invalid xml or something...
I know that this feature is possible with various forum scripts out there as I've seen it before, but would love to achieve this?
Any help or suggestions would be greatly appreciated.

thank you in advance! :)
Title: Re: display recent threads/posts on another page/site
Post by: Nathaniel on August 30, 2008, 08:56:07 AM
You can use the SSI.php functions to show information about your forum on another page in your website.

Have a read of the SSI.php documentation:
SSI Readme (http://docs.simplemachines.org/index.php?topic=400)
How do I integrate SMF into my PHP coded website? (http://docs.simplemachines.org/index.php?topic=461)

You will want the 'ssi_recenttopics()' or 'ssi_recentPosts()' functions. ;)
Title: Re: display recent threads/posts on another page/site
Post by: reves on August 30, 2008, 09:01:43 AM
this is exactly what I was after. thank you very much for your quick reply!
Title: Re: display recent threads/posts on another page/site
Post by: reves on August 30, 2008, 10:10:52 AM
does anybody know how to alter the font properties of what SSI outputs to my external pages?
Title: Re: display recent threads/posts on another page/site
Post by: Nathaniel on August 30, 2008, 07:26:00 PM
You can completely customize the output of a 'SSI.php' function by passing the last option variable which will tell SMF to return the data to you instead of actually showing it. Below is an example for the 'ssi_recentTopics()' function. Please note that I took all of the 'echo' code from the ssi function, you can repeat this process for every function, to get a similar output, but then customize it how you want to. ;)

require("SSI.php");
$posts = ssi_recentTopics(8, null, '');
echo '
<table border="0" class="ssi_table" style="font-size:20px;">';
foreach ($posts as $post)
echo '
<tr>
<td align="right" valign="top" nowrap="nowrap">
[', $post['board']['link'], ']
</td>
<td valign="top">
<a href="', $post['href'], '">', $post['subject'], '</a>
', $txt[525], ' ', $post['poster']['link'], '
', $post['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt[302] . '" border="0" /></a>', '
</td>
<td align="right" nowrap="nowrap">
', $post['time'], '
</td>
</tr>';
echo '
</table>';