News Scripting for SMF 2.0
That is all you need to do to get your basic script running. You can add any of the following to the end of that, but make sure you put a semicolon (;) between each variable. These variables aren't needed, but provide better versatility.
Setup the include statement on the page you wish your news to appear on according to the type of file you will be using (either PHP or SHTML.) This example will use PHP.
Start with the include to point to SSI.php in your root SMF directory.
e.g. <?php include('https://www.simplemachines.org/community/SSI.php'); ?>
Add ?ssi_function=boardNews;board=n to the end of the URL above. Make sure you replace the n with the number of the board you want news to appear from.
e.g. <?php echo file_get_contents('https://www.simplemachines.org/community/SSI.php?ssi_function=boardNews;board=9'); ?>
e.g. <?php echo file_get_contents('https://www.simplemachines.org/community/SSI.php?ssi_function=boardNews;board=9;limit=7'); ?>
- Limits the amount of news items to show (the default is 5.)
- Limits the length of each post to n characters (the default is to impose no limit.)
- Starts the news items at a certain offset. (the default is 0)
This shows an example of how one might change the limit on the news items.
Copyright ©2020 Simple Machines.