Advertisement:

Navigation

SMF Mod Site

Mod Name:
SSI Multiple Board News (ssi_multiBoardNews)
Created By:
vbgamer45
Type:
SSI
First Created:
November 17, 2009, 07:01:41 PM
Last Modified:
May 15, 2017, 09:10:30 AM
Latest Version:
2.0
Compatible With:
1.1.17, 1.1.19, 1.1.21, 2.0.3, 2.0.6, 2.0.12, 2.0.13, 2.0.14
Total Downloads:
2293

Download this mod

ssi_multiboardnews 2.0.zip (11kB) [911]
Manual Install Instructions for SMF

Description:

SSI Multiple Board News (ssi_multiBoardNews)


Original Author: Arantor
SMF Version: 2.0.x and 1.1.X
Mod Version: 2.0

Description:
One of the functions built into SMF's SSI.php is the ability to get topics from a board in order to use it to display 'news', the venerable ssi_boardNews.

After receiving several customisation requests though, I finally decided to write a more powerful version, ssi_multiBoardNews.

You still have to use SSI.php, but you can substitute calls to this instead of ssi_boardNews, but as I'll explain in a moment, it isn't just a list of options like:

Code: [Select]
ssi_multiBoardNews(10, x, y, z, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
There are just too many options, so instead, you build an array first, simply because of the number of options this function has, it's not really viable to do anything else.

You call it: ssi_multiBoardNews($parameters), where $parameters contains the following:

$parameters['board'] - an integer board id or array of board ids from which to get topics
$parameters['board_disp'] - true/false, display the board name in output, default true
$parameters['category'] - an integer category id, or array of category ids from which to get topics
$parameters['category_disp'] - true/false, display the category name in out, default false
$parameters['limit'] - number of topics to get, default 5
$parameters['start'] - number of topics to skip over, for pagination, default 0 (start at the most recent)
$parameters['length'] - optional maximum length of topic first posts, in characters, defaults to no limit
$parameters['perms_override'] - true/false (default false), whether to override the permissions check; by default guests have to be able to see the board - this allows you to have a hidden 'news' board so that only admins can see it, and allow it to be viewed by guests.
$parameters['icon'] - optional, limits the scope to one or more icons.
$parameters['attachments'] - whether to display attachments or not, supports any one of the following string options: (NB. This still uses the main attachments system. The board would have to have permissions for guests to be able to view attachments.)

    'none', the default, does not show attachments
    'linkonly', displays only links to the attachments
    'thumbnail', displays image thumbnails and links them to the attachments
    'inline', displays the full images from image attachments, links to other attachments

$parameters['avatar'] - whether to display the poster's avatar or not, supports any one of the following string options:

    'none', the default, display no avatar
    'left', display it to the left of the post
    'right', display it to the right of the post

$parameters['feed'] - displays the appropriate feed links. Unlike the others, this is an array of strings field. See below.

    'none', the default, displays no feed
    'rss', displays the RSS feed link for the board(s) you select
    'atom', displays the ATOM feed link for the board(s) you select
    'rdf', displays the RDF feed link for the board(s) you select

    To display multiple feeds, enter as such:
    $parameters['feed'] = array('rss', 'atom');
    If SMF supports different things later on, this can be used to expand them without serious recoding.

$parameters['output_type'] - either 'echo' or 'array'. 'echo', default, outputs normally, 'array' returns to your code (note that avatars and attachments are only returned is $parameters['avatar'] and $parameters['attachments'] are set to something other than avatar type 'none' and attachment type 'none' for performance reasons.


Some examples:
Fetching the most recent 10 topics from across boards 1, 2 and 5:
Code: [Select]
$parameters = array(
  'limit' => 10,
  'board' => array(1,2,5),
);
ssi_multiBoardNews($parameters);

To get 15 topics from boards 1 and 2, plus all the boards in category 12, displaying the avatars on the left of the posts, and displaying both the board and category name in the output too, oh and limiting it to only thumbup posts (using the thumbs up icon):
Code: [Select]
$parameters = array(
  'limit' => 15,
  'board' => array(1,2),
  'category' => array(12),
  'board_disp' => true,
  'category_disp' => true,
  'avatar' => 'left',
  'icon' => 'thumbup',
);
ssi_multiBoardNews($parameters);

Why Not Visit:
http://www.smfhacks.com