SMF SSI.php Functions
Current Version: 2.0 RC3
This file is used to demonstrate the capabilities of SSI.php using PHP include functions. The examples show the include tag, then the results of it.
Include Code
To use SSI.php in your page add at the very top of your page before the <html> tag on line 1 of your php file:
<?php require("SSI.php"); ?>
Some notes on usage
All the functions have an output method parameter. This can either be "echo" (the default) or "array"
If it is "echo", the function will act normally - otherwise, it will return an array containing information about the requested task. For example, it might return a list of topics for ssi_recentTopics.
This functionality can be used to allow you to present the information in any way you wish.
Additional Guides & FAQ
Need more information on using SSI.php? Check out Using SSI.php article or the SSI FAQ.
Recent Topics Function
Code (simple mode)
<?php ssi_recentTopics(); ?>
Code (advanced mode)
<?php ssi_recentTopics($num_recent = 8, $exclude_boards = null, $include_boards = null, $output_method = 'echo'); ?>
Result
| [SMF 1.x Support] | Quick Reply Feature by Ha² | Today at 12:21:06 AM |
| [SMF Feedback and Discussion] | MOVED: Spider by Kindred | Today at 12:13:42 AM |
| [Theme Site Themes] | BlackRainV.2 by slowdive | Today at 12:13:38 AM |
| [Chit Chat] | An impassioned plea to everyone regarding the SMF Restructuring issues by opheliagrimm | Today at 12:06:59 AM |
| [Temas y Diseño (Themes)] | Ayuda con mi tema by Kyoshō-Odin | Today at 12:04:47 AM |
| [SMF 1.x Support] | Text Characters replaced with boxes? by aprild | Today at 12:01:28 AM |
| [Theme Previews] | [PREVIEW] Chocolate theme by zυтzυ | Yesterday at 11:57:54 PM |
| [Modifications and Packages] | Thank-O-Matic (Version 1.2.5) by soulgeek | Yesterday at 11:39:54 PM |
Recent Posts Function
Code
<?php ssi_recentPosts(); ?>
Result
| [SMF 1.x Support] | Re: Quick Reply Feature by Ha² | Today at 12:21:06 AM |
| [SMF Feedback and Discussion] | MOVED: Spider by Kindred | Today at 12:13:42 AM |
| [Theme Site Themes] | Re: BlackRainV.2 by slowdive | Today at 12:13:38 AM |
| [SMF 1.x Support] | Quick Reply Feature by forfun | Today at 12:12:43 AM |
| [Chit Chat] | Re: An impassioned plea to everyone regarding the SMF Restructuring issues by opheliagrimm | Today at 12:06:59 AM |
| [Temas y Diseño (Themes)] | Re: Ayuda con mi tema by Kyoshō-Odin | Today at 12:04:47 AM |
| [SMF 1.x Support] | Re: Text Characters replaced with boxes? by aprild | Today at 12:01:28 AM |
| [Theme Previews] | [PREVIEW] Chocolate theme by zυтzυ | Yesterday at 11:57:54 PM |
Top Boards Function
Shows top boards by the number of posts.
Code
<?php ssi_topBoards(); ?>
Result
| Board | Topics | Posts |
|---|---|---|
SMF 1.x Support ![]() |
71,929 | 440,304 |
| SMF Online Manual | 0 | 283,288 |
Modifications and Packages ![]() |
1,643 | 179,174 |
Türkçe Bölümü (Turkish) ![]() |
23,680 | 162,531 |
Español (Spanish) ![]() |
18,190 | 104,616 |
SMF Coding Discussion ![]() |
15,815 | 97,870 |
Chit Chat ![]() |
5,580 | 79,864 |
Install and Upgrade Help ![]() |
12,100 | 76,752 |
SMF 2.x Support ![]() |
10,079 | 66,601 |
Graphics and Templates ![]() |
10,288 | 64,558 |
Top Topics
Shows top topics by the number of replies or views.
Code (show by number of views)
<?php ssi_topTopicsViews(); ?>
Result
| Views | Replies | |
|---|---|---|
| nneonneo's Shoutbox | 1,212,633 | 5,893 |
| SMF Arcade | 800,689 | 4,318 |
| Pretty URLs 1.0RC - Updated for SMF 2.0 RC3 | 724,221 | 5,027 |
| Ad Management mod 2.6.3.1 Released SMF RC3 Support! | 670,427 | 5,038 |
| Aeva Media 1.1a (Mar 12, 2010) (Gallery & auto-embedder for YouTube etc.) | 642,881 | 1,889 |
| SMF Media Gallery (SMG) - 2.0.5 is out! (December 2) | 527,748 | 5,528 |
| Custom Profile Field Mod | 522,534 | 2,882 |
| SMFShop- Version 3.1.5 Now SMF 2.0 RC3 Support! | 472,173 | 2,220 |
| AjaxChat Integration (latest version 3.2.1) | 469,309 | 5,491 |
| Integrated Chat Mod | 445,143 | 1,867 |
Code (show by number of replies)
<?php ssi_topTopicsReplies(); ?>
Result
| Views | Replies | |
|---|---|---|
| nneonneo's Shoutbox | 1,212,633 | 5,893 |
| SMF Media Gallery (SMG) - 2.0.5 is out! (December 2) | 527,748 | 5,528 |
| AjaxChat Integration (latest version 3.2.1) | 469,309 | 5,491 |
| Ad Management mod 2.6.3.1 Released SMF RC3 Support! | 670,427 | 5,038 |
| Aeva 6.9.99 and earlier (old) | 19,386 | 5,030 |
| Pretty URLs 1.0RC - Updated for SMF 2.0 RC3 | 724,221 | 5,027 |
| SMF Arcade | 800,689 | 4,318 |
| SimplePortal - 2.3.1 Released! | 395,146 | 3,066 |
| Custom Profile Field Mod | 522,534 | 2,882 |
| SMF Gallery 2.1 (March 8) with SMF 2.0 RC3 Support! | 410,380 | 2,541 |
Top Poster Function
Shows the top poster's name and profile link.Code
<?php ssi_topPoster(); ?>
Result
Latest Member Function
Shows the latest member's name and profile link.
Code
<?php ssi_latestMember(); ?>
Result
Member of the Day
Shows one random member of the day. This changes once a day.
Code
<?php ssi_randomMember('day'); ?>
Result
Who's Online Function
This function shows who are online inside the forum.
Code
<?php ssi_whosOnline(); ?>
Result
MarcusJ, S-Ace, rgecy, neary, vbgamer45, beau1943, MothMan, slowdive, fords8, adinrivera, forfun, baldur2630, Rayder, can_m, SONSiVRi, Xarcell, tumbleweed, Kyoshō-Odin, Kindred, juanmorris, coniito, Garry1953, luchos, weekend camper, msginabttl, Deus Figendi, klaus3, scoops09, Flammifer, Smartflight, Dismal Shadow, hcvshare, BlueDevil, Lucas61, butchs, Lugial, opheliagrimm, sokahar, Orstio, goldenfox27, kosaic, NIBOGO, christianjb2006, porridgehead, aprild, KahneFan, azgamers, andy_kim, Slateer, lc62003, agridoc, Jesus Lozano, Brack1, alfzer0, whoosh, Martin12, jack3d, trebul, mrtrc266, OChaos, Bugo, maximus23, vaxik, Cassiel, engr_dood, lemo
Log Online Presence
This function logs the SSI page's visitor, then shows the Who's Online list. In other words, this function shows who are online inside and outside the forum.
Code
<?php ssi_logOnline(); ?>
Result
MarcusJ, S-Ace, rgecy, neary, vbgamer45, beau1943, MothMan, slowdive, fords8, adinrivera, forfun, baldur2630, Rayder, can_m, SONSiVRi, Xarcell, tumbleweed, Kyoshō-Odin, Kindred, juanmorris, coniito, Garry1953, luchos, weekend camper, msginabttl, Deus Figendi, klaus3, scoops09, Flammifer, Smartflight, Dismal Shadow, hcvshare, BlueDevil, Lucas61, butchs, Lugial, opheliagrimm, sokahar, Orstio, goldenfox27, kosaic, NIBOGO, christianjb2006, porridgehead, aprild, KahneFan, azgamers, andy_kim, Slateer, lc62003, agridoc, Jesus Lozano, Brack1, alfzer0, whoosh, Martin12, jack3d, trebul, mrtrc266, OChaos, Bugo, maximus23, vaxik, Cassiel, engr_dood, lemo
Login Function
Shows a login box only when user is not logged in.
Code
<?php ssi_login(); ?>
Result
Logout Function
Shows a logout link only when user is logged in.
Code
<?php ssi_logout(); ?>
Result
Welcome Function
Greets users or guests, also shows user's messages if logged in.
Code
<?php ssi_welcome(); ?>
Result
Today's Calendar Function
Code
<?php ssi_todaysCalendar(); ?>
Result
Upcoming Birthdays: Yngwiedis (35), wizzie (59), AleXit (26), SolidT (23), An Sionnach (41), schrombot (25), bap (42), nend (27), jawad (22), PSNick (20), SRaven (37), Rozzoe (40), Niri (34), Ryanator (27), dazzatheowl (16), CybeR.BoyS ™ (19), dreamliner (15), James Woodcock (29), writeto, snailofsatan (32), devilsknight187 (32), MaSt3R (21), Kucuro (40), perplexed, Ileana (21), joanne (39), Normally (45), kelf1975 (1813), ozlacs (26), amity21 (26), vlindertje (28), Nadavetti (19), Mürşidim (16), Tiribulus (46), MadAsToast (40), Viking Chief (46), Vanish (40), X-Ception (28), andrewk (33), SleePy (21), Leonard C (46), Savanni (17), joshlfisher (26), ProtoMan.EXE (18), Vargas (47), SvenJTD (30), Iomega0318 (23), hippo666 (47), elpropiohechicero (56), JoshieDaMan (23), Kirok (39), Wolff-Fans (17), Ol' Wombat (51), club88zaa (27), Demonavenger (18), zυтzυ (18), Imô¿ôu2 (50), carterx (27), zorro18 (2), graaywolf (51), noex (28), Burpee (25), Andi (50), Storm (26), code (250), Gabrius (41), Humbe (21), uni (23), krustyop (35), silverf0x (24), Lord_Lethris (33), Renegade Magazine (20), paulwalker71 (51), Bikken (37), NightOwl51 (54), taham1peace (23), Canwolf (64), JCox (40), JBlaze (21), greyfox220 (19), peluche (47), melisa (28), L.A., rpatin (34), Dio (38), Beldin (27), GoLGe_ (21), LinuxDonald (24), sc0ttish (31), nimd4 (33), Bluearrow, ckay (33), dirkyboy (26), LexArma (26), SeW800 (21), Bonafide (20), Groundhog (47), Brande (34), Forum Guy (51), Curbow 5 (30), morpheus2008 (48), Yedidya (23), drygnfyre (22), Nao (35), ssoltz (44), kaizen (49), lorrcarter (23), BaezoN (30), ELPARIA (33), axaesque (40), MaxisSpieler (18), bumperskittles, VaTaN84 (26), jamlvs (34), Hanso (18), VeeDubbinMKIV (22), classics4me (63), PRaDiUS (26), emre_k (24), newcyberian (45), Broetals (24), Eisbein (36), futeball (32), mbanusick2 (17)
Today's Birthdays Function
Code
<?php ssi_todaysBirthdays(); ?>
Result
Today's Holidays Function
Code
<?php ssi_todaysHolidays(); ?>
Result
Today's Events Function
Code
<?php ssi_todaysEvents(); ?>
Result
Forum Stats
Shows some basic forum stats: total members, posts, topics, boards, etc.
Code
<?php ssi_boardStats(); ?>
Result
Total Posts: 2,394,798
Total Topics: 305,081
Total Categories: 14
Total Boards: 181
News Function
Shows random forum news.
Code
<?php ssi_news(); ?>
Result
Board News Function
Shows the latest posts from read only boards, or a specific board.
Code
<?php ssi_boardNews(); ?>
Result
A reminder to update your email and passwords
The Simple Machines Team would like to ask all of our users to please check their profiles and update their email addresses. By keeping this information updated, we can continue to contact you with notifications regarding updates such as new releases.
For some time now, after sending announcements such as the "SMF 2.0 RC3 release announcement", we received bounce messages from some of our community members. Some of those members may have received a personal message (PM) recently about the bounced message. Thank you for those who taken their time after receiving the PM to update your contact details.
Some auto replies also indicate the need for us to reply to verify our existence. We will not be replying to these emails and they will be deleted. In addition you may receive the PM informing you of this. The simplest solution would be for you to white list simplemachines.org. If you're not sure how to do this, your email host will have information regarding adding a domain to your white list.
In addition to updating emails, the Simple Machines Team would like to remind all of our community users to update passwords and/or secret questions/answers. Weak passwords or secret questions/answers can lead to your account being compromised. We have had a couple cases recently of this occurring. Please ensure your password is a strong complex password and your secret question and answer is information only you know.
SMF 2.0 Release Candidate 3 is out!
We are pleased to announce the immediate release of SMF 2.0 RC3 to the public. This version marks the third release candidate for 2.0, including about 350 new entries in the change log, consisting mostly of bug fixes, interface tweaks and fine-tuning of the new Curve theme.
We strongly recommend all users of earlier development releases to upgrade to this release, for it contains several security fixes.
While we are confident that there are no major problems with this release, we want to remind you that it is still not to be considered stable software. We do not recommend its use in live environments and if you are not comfortable with using this release candidate, we advise you to wait until the release of the final version before using the 2.0 line.
Highlights of this release include:
- Several security-related fixes.
- Better compatibility with RTL languages.
- Added curvy headers to loads of tables throughout SMF for the best Curve experience.
- Fine-tuned conversation view in the personal messages section.
- Improved read tracking of topics; e.g. topics are now marked as read by pages, to allow easier resuming of reading.
- Several tweaks to the WYSIWYG editor; now automatically disabled on mobile devices.
- Post screens (new topic, etc) are center aligned again.
- Buttons are now aligned much more consistently throughout SMF.
- Row color alternation to most of the tables in the administrative areas.
- Redesigned profile statistics centre.
- Fixed install and upgrade script for PostgreSQL.
- Updated help section.
- Revamped SSI examples page.
- Rephrasing of several error messages.
- Improvements to the package manager's archive extraction algorithm.
- Toggling of full size versions of resized images.
- Altered styling for quotes and code blocks.
Those interested in the detailed changelog may like to download it from our download page.
Finally - please do not use this topic for any support requests. You will get a much more prompt response by visiting the relevant support board!
Regards,
Simple Machines
Server Maintenance 12/31/09
be at the datacenter tomorrow, 12/31/09 around 2PM EST to do a little server maintenance. The site will probably be down for 45 minutes or so.
SMF 1.1.11 released
Upgrade automatically by visiting your administration center, where a notice will be displayed prompting you to upgrade. Click the link, confirm the changes and your forum will be up to date again. Additionally, you can upgrade using the package manager by downloading the attached patch, uploading it to the package manager, and applying it as prompted. For help with this refer to the Package Manager section of the Online Manual.
If you cannot upgrade using the package manager, please follow the instructions posted in the Online Manual about installing and upgrading. If you experience a session verification error when inputting FTP details for updating process, please see this topic.
It may be necessary to apply the upgrade manually if mod conflicts mean that you cannot install the patch through the package manager. Instructions for doing this can be found on manual upgrades page for SMF 1.1.11 and 1.0.19.
Finally - please do not use this topic for any support requests. You will get a much more prompt response by visiting the relevant support board!
Regards,
Simple Machines
Smiley Contest: THE WINNERS!!
An SMF team and charter vote has finally given us a winner. Before we announce the winner, we wish to thank Spektral, SoLoGHoST and islam2hamy for making it through to the final. Your smileys are now on the long awaited "Smiley of the moment" feature in the admin panel. We would love to see more smileys in future from all of you!
However there must be only one winner. After counting the scores we are happy to announce that first prize goes to:
SoLoGhOsT with his Solosmileys Non Animated
The Winning Entry
Recent Attachments Function
Code
<?php ssi_recentAttachments(); ?>
Result
| File | Posted by | Downloads | Filesize |
|---|---|---|---|
| SleePy | 6670 | 11.56kB | |
| Compuart | 5642 | 10.13kB | |
| Compuart | 4811 | 64.38kB | |
| Compuart | 7257 | 118.36kB | |
| Compuart | 3506 | 44.16kB | |
| noex | 541 | 3.5kB | |
| noex | 420 | 44.01kB | |
| MrPM | 504 | 26.22kB | |
| Neakro | 519 | 3.25kB | |
| mediman | 972 | 36.04kB |
Show Single Poll
Shows a poll in the specified topic.
Code
<?php ssi_showPoll($topicID); ?>
Result
Show Single Post
Fetches a post with a particular IDs. By default will only show if you have permission to the see the board in question. This can be overriden by passing the 2nd parameter as true.
Code
<?php ssi_fetchPosts($postIDs, $isOverride); ?>
Result
Show Single Member
Shows the specified member's name and profile link.
Code
<?php ssi_fetchMember($memberIDs); ?>
Result
Show Group Members
Shows all members in a specified group.
Code
<?php ssi_fetchGroupMembers($groupIDs); ?>
Result
Home Page Sample
This sample uses the following features: ssi_recentTopics(), ssi_logOnline(), ssi_welcome(), and ssi_boardNews(). ssi_recentTopics() is fetched using the array method, to allow further customizations on the output.Code
<?php require("SSI.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SSI.php example for home page</title>
<style type="text/css">
body { font-family: Arial, Tahoma, sans-serif; font-size: 80%; background: #DFDFDF; color: #FFFFFF; margin: 0 }
ul,ol { padding-left: 19px; margin: 0; }
li { font-size: 11px; }
h1,h2,h3 { margin: 0; padding: 0; }
h3 { font-size: 15px; }
a:link,a:visited { color: #FF9000; text-decoration: none; }
a:hover { text-decoration: underline; }
#container { background: #52514E; width: 100%; border: 1px solid midnightblue; line-height: 150%; margin: 0; }
#header,#footer { color: lightgray; background-color: #2A2825; clear: both; padding: .5em; }
#leftbar { background: #DF7E00; float: left; width: 160px; margin: 0; padding: 1em; }
#leftbar a { color: #000000; text-decoration: underline; }
#content { margin-left: 190px; padding: 1em; }
#navigation { float: right; }
#navigation a:link,#navigation a:visited { color: #FF9000; }
</style>
</head>
<body>
<div id="container">
<div id="header">
<div id="navigation">
<a href="#">Link</a> | <a href="#">Link</a> | <a href="#">Link</a> | <a href="#">Link</a> | <a href="#">Link</a>
</div>
<h1 class="header">YourWebsite.com</h1>
</div>
<div id="leftbar">
<h3>Recent Forum Topics</h3>
<ul>
<?php
// Using array method to show shorter display style.
$topics = ssi_recentTopics(8, null, null, 'array');
foreach ($topics as $topic)
{
// Uncomment the following code to get a listing of array elements that SMF provides for this function.
// echo '<pre>', print_r($topic), '</pre>';
echo '
<li><a href=\"', $topic['href'], '\">', $topic['subject'], '</a> ', $txt['by'], ' ', $topics[$i]['poster']['link'], '</li>';
}
unset($topics);
?>
</ul><br />
<h3>Online Users</h3>
<?php ssi_logOnline(); ?>
</div>
<div id="content">
<?php ssi_welcome(); ?><br /><br />
<h2>News</h2>
<?php ssi_boardNews(); ?>
</div>
<div id="footer">
<a target="_blank" rel="license" href="http://creativecommons.org/licenses/publicdomain/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/publicdomain/88x31.png" /></a>
This sample website layout is dedicated to the <a target="_blank" rel="license" href="http://creativecommons.org/licenses/publicdomain/">Public Domain</a>.
</div>
</div>
</body>
</html>
