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:

Code: [Select]
<?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)

Code: [Select]
<?php ssi_recentTopics(); ?>

Code (advanced mode)

Code: [Select]
<?php ssi_recentTopics($num_recent = 8, $exclude_boards = null, $include_boards = null, $output_method = 'echo'); ?>

Result

Recent Posts Function

Code

Code: [Select]
<?php ssi_recentPosts(); ?>

Result

Recent Poll Function

Code

Code: [Select]
<?php ssi_recentPoll(); ?>

Result

Top Boards Function

Shows top boards by the number of posts.

Code

Code: [Select]
<?php ssi_topBoards(); ?>

Result

Board Topics Posts
SMF 1.x Support New 71,929 440,304
SMF Online Manual 0 283,288
Modifications and Packages New 1,643 179,174
Türkçe Bölümü (Turkish) New 23,680 162,531
Español (Spanish) New 18,190 104,616
SMF Coding Discussion New 15,815 97,870
Chit Chat New 5,580 79,864
Install and Upgrade Help New 12,100 76,752
SMF 2.x Support New 10,079 66,601
Graphics and Templates New 10,288 64,558

Top Topics

Shows top topics by the number of replies or views.

Code (show by number of views)

Code: [Select]
<?php ssi_topTopicsViews(); ?>

Result

Code (show by number of replies)

Code: [Select]
<?php ssi_topTopicsReplies(); ?>

Result

Top Poll Function

Shows the most-voted-in poll.

Code

Code: [Select]
<?php ssi_topPoll(); ?>

Result

Top Poster Function

Shows the top poster's name and profile link.

Code

Code: [Select]
<?php ssi_topPoster(); ?>

Result

Latest Member Function

Shows the latest member's name and profile link.

Code

Code: [Select]
<?php ssi_latestMember(); ?>

Result

Please welcome slowdive, our newest member.

Member of the Day

Shows one random member of the day. This changes once a day.

Code

Code: [Select]
<?php ssi_randomMember('day'); ?>

Result

Who's Online Function

This function shows who are online inside the forum.

Code

Code: [Select]
<?php ssi_whosOnline(); ?>

Result

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

Code: [Select]
<?php ssi_logOnline(); ?>

Result

Login Function

Shows a login box only when user is not logged in.

Code

Code: [Select]
<?php ssi_login(); ?>

Result

 
 

Logout Function

Shows a logout link only when user is logged in.

Code

Code: [Select]
<?php ssi_logout(); ?>

Result

Welcome Function

Greets users or guests, also shows user's messages if logged in.

Code

Code: [Select]
<?php ssi_welcome(); ?>

Result

Welcome, Guest. Please login or register.
Did you miss your activation email?

Today's Calendar Function

Code

Code: [Select]
<?php ssi_todaysCalendar(); ?>

Result

St. Patrick's Day, Vernal Equinox
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

Code: [Select]
<?php ssi_todaysBirthdays(); ?>

Result

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 Holidays Function

Code

Code: [Select]
<?php ssi_todaysHolidays(); ?>

Result

St. Patrick's Day, Vernal Equinox

Today's Events Function

Code

Code: [Select]
<?php ssi_todaysEvents(); ?>

Result

Recent Calendar Events Function

Code

Code: [Select]
<?php ssi_recentEvents(); ?>

Result

Forum Stats

Shows some basic forum stats: total members, posts, topics, boards, etc.

Code

Code: [Select]
<?php ssi_boardStats(); ?>

Result

Total Members: 214,911
Total Posts: 2,394,798
Total Topics: 305,081
Total Categories: 14
Total Boards: 181

News Function

Shows random forum news.

Code

Code: [Select]
<?php ssi_news(); ?>

Result

Wondering if this will always be free?  See why free is better.

Board News Function

Shows the latest posts from read only boards, or a specific board.

Code

Code: [Select]
<?php ssi_boardNews(); ?>

Result

xx A reminder to update your email and passwords

Yesterday at 06:22:33 PM by SleePy
Hello community,

    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.
2 comments | Write Comment

xx SMF 2.0 Release Candidate 3 is out!

March 08, 2010, 06:03:11 PM by Aäron
Hello all,

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
200 comments

xx Server Maintenance 12/31/09

December 30, 2009, 09:39:39 PM by dschwab9
Just wanted to give everyone a heads up that I will
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.
20 comments

clip SMF 1.1.11 released

December 01, 2009, 05:59:19 PM by SleePy
Simple Machines announces the release of SMF 1.1.11, addressing multiple vulnerabilities found in SMF 1.1.10. Also for those still using the SMF 1.0.x branch, an upgrade to 1.0.19 was released. We strongly recommend that all users upgrade as soon as possible.

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
188 comments

xx Smiley Contest: THE WINNERS!!

November 02, 2009, 05:55:27 AM by Runic
Two months ago we launched a competition to look for more smiley sets. We received many applications. However many used copyrighted images, which we cannot permit. After much work we shortlisted four sets from all the submissions that met the guidelines.
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
106 comments | Write Comment

Menubar Function

Displays a menu bar, like one displayed at the top of the forum.

Code

Code: [Select]
<?php ssi_menubar(); ?>

Result

Quick Search Function

Code

Code: [Select]
<?php ssi_quickSearch(); ?>

Result

Recent Attachments Function

Code

Code: [Select]
<?php ssi_recentAttachments(); ?>

Result

Show Single Poll

Shows a poll in the specified topic.

Code

Code: [Select]
<?php ssi_showPoll($topicID); ?>

Result

Not shown because it needs specific topic ID that contains a poll.

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

Code: [Select]
<?php ssi_fetchPosts($postIDs, $isOverride); ?>

Result

Not shown because it needs a specific post ID.

Show Single Member

Shows the specified member's name and profile link.

Code

Code: [Select]
<?php ssi_fetchMember($memberIDs); ?>

Result

Not shown because it needs a specific member ID.

Show Group Members

Shows all members in a specified group.

Code

Code: [Select]
<?php ssi_fetchGroupMembers($groupIDs); ?>

Result

Not shown because it needs specific membergroup IDs.

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

Code: [Select]
<?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>

Result