![]()
Let's create a very simple recent topics block using SMF's own SSi function without modifying the SSI.php file. In this tutorial we're going to add several boards with the last five recent topics.
In this demo, I'm using a bit of styling to make it look pretty but the code below it's in raw form. I'll provide the full stylized code as well. I'm also using 3 boards with the last 5 topics created from Themes, Mods and Tutorial boards. You can change this and add as many boards as you want and add as many recent topics as you want.
Create a PHP block using your favorite portal and add the following:
echo '
<br />';
$array = ssi_boardNews(16.0, 5, null, 250, 'array');
echo '
<div align="Left"><h2>Tutorials</h2></div>';
foreach ($array as $news)
{
echo '
<div align="left"><a href="', $news['href'], '">', $news['subject'], '</a></div>';
}
echo '
<br />';
$array = ssi_boardNews(15.0, 5, null, 250, 'array');
echo '
<div align="Left"><h2>Plugins</h2></div>';
foreach ($array as $news)
{
echo '
<div align="left"><a href="', $news['href'], '">', $news['subject'], '</a></div>';
}
echo '
<br />';
$array = ssi_boardNews(74.0, 5, null, 250, 'array');
echo '
<div align="Left"><h2>Themes</h2></div>';
foreach ($array as $news)
{
echo '
<div align="left"><a href="', $news['href'], '">', $news['subject'], '</a></div>';
}
echo '
<br />';
What needs to be changed to suit your needs... for example,
$array = ssi_boardNews(16.0, 5, null, 250, 'array');
*The
16.0 is the board number, you can find the board number by hovering over the board name with your cursor and see it in the top or bottom of your browser.
*The
5 is the number of recent topics, you can change this to a different value. Like 10 or 15.
* The
250 is the length of the title, you can change this to 300 if your titles are very long.
* Make sure you change the category names with your own inside the
<h2> brackets.
The next code is the same but with some icons.
It's totally up to you to stylize it. I use icons from
Font Awesome and to use this, simply add this line to your index.template.php
Find:
// Output any remaining HTML headers. (from mods, maybe?)
echo $context['html_headers'];
echo '
Add after:
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" crossorigin="anonymous" />
Stylized code:
echo '
<br />';
$array = ssi_boardNews(16.0, 5, null, 250, 'array');
echo '
<div align="Left"><h2><i class="fas fa-caret-right"></i> Tutorials</h2></div>';
foreach ($array as $news)
{
echo '
<div align="left"><a href="', $news['href'], '">', $news['subject'], '</a></div>';
}
echo '
<br />';
$array = ssi_boardNews(15.0, 5, null, 250, 'array');
echo '
<div align="Left"><h2><i class="fas fa-caret-right"></i> Plugins</h2></div>';
foreach ($array as $news)
{
echo '
<div align="left"><a href="', $news['href'], '">', $news['subject'], '</a></div>';
}
echo '
<br />';
$array = ssi_boardNews(74.0, 5, null, 250, 'array');
echo '
<div align="Left"><h2><i class="fas fa-caret-right"></i> Themes</h2></div>';
foreach ($array as $news)
{
echo '
<div align="left"><a href="', $news['href'], '">', $news['subject'], '</a></div>';
}
echo '
<br />';
Replace:
<i class="fas fa-caret-right"> with your icon of choice found here
Font Awesome IconsReference:
Advanced SSIIcons used:
Font Awesome Icons