Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: vbgamer45 on December 25, 2009, 01:57:08 AM

Title: SSI Multiple Board News (ssi_multiBoardNews)
Post by: vbgamer45 on December 25, 2009, 01:57:08 AM
Link to Mod (https://custom.simplemachines.org/mods/index.php?mod=2280)

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:
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:
$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):
$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 (http://www.smfhacks.com)
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: JBlaze on December 25, 2009, 01:59:17 AM
Congrats on another approved mod spammer :P
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: mira-san on December 25, 2009, 05:24:49 PM
Thank you very much, I was waiting for this mod ;D
I have a small question:
-How can I view the last 5 news of the section n°: 2.0, cat 1, with the avatar display on the left in my website index.php?

I have tried this in my index.php but it doesn't work:

$parameters = array(
  'limit' => 5,
  'board' => array(2.0),
  'category' => array(1),
  'board_disp' => false,
  'category_disp' => false,
  'avatar' => 'left',
  'icon' => 'none',
);
ssi_multiBoardNews($parameters);
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: mira-san on December 25, 2009, 05:42:34 PM
I used this code and it works perfectly.

$parameters = array(
  'limit' => 5,
  'board' => array(2),
  'avatar' => 'left',
);
ssi_multiBoardNews($parameters);


Once again, Thank you so much for this fabulous mod. :)
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: ianus on December 26, 2009, 10:56:05 AM
Greetings! and Great!!

A while ago I asked for a solution to grab only threads which have a unique icon. (Change SSI function or create a new one to grab specific threads. (http://www.simplemachines.org/community/index.php?topic=306476.msg2029497#msg2029497))

I struggle around with the new SSI to reproduce the changes and now you offer everything I need.

Thanks a lot for this modification!
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: trzycha on December 28, 2009, 03:55:04 PM
Thanks
Will $parameters[ 'icon'] display only 1 post, or any other posts from topic that are marked with post icon? It would be great if it display all posts from topic  that are marked with a post icon.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: bayken37 on December 30, 2009, 10:26:20 PM
I've added this mod to my SSI.php file like that page says, but I keep getting the following error : "Parse error: parse error, unexpected '}' in /home/content/b/a/y/bayken37/html/forum/SSI.php on line 1974"

I re-installed the SMF package, but got the same thing.  Am I doing something wrong?

Thanks for any help!
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: bayken37 on December 30, 2009, 10:35:43 PM
Here we are.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Yağız... on January 01, 2010, 06:00:34 PM
Hey Arantor,

I have found a bug :)
When you use 'output_method' => 'array', the result returns blank. It's because of this:
if ($parameters['output_type'] != 'echo')
return $return;

It should be:
if ($parameters['output_type'] != 'echo')
return $return['topics'];
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Yağız... on January 01, 2010, 06:15:03 PM
Oh, yeah you're right :) I never thought that.

Nevermind, thanks for this usefull mod ^^
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: MH-MINI on January 04, 2010, 12:10:04 AM
Hi, I'm using SMF 2.0 RC2 and I get the following error from Package manager when I try to install this mod.

1.     Execute Modification     ./SSI.php     Test failed
      1.    Replace    ./SSI.php    Test successful
      2.    Replace    ./SSI.php    Test failed
      3.    Replace    ./SSI.php    Test failed
      4.    Add After    ./SSI.php    Test failed
      5.    Add After    ./SSI.php    Test failed

What is the problem here?

Thanks
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: MH-MINI on January 04, 2010, 02:51:25 AM
Yes you were correct. Sorry about that.

One quick question though. By default it says that it will show the last 5 posts for boardnews. I was wondering how I could make this indefinite?

Thanks
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Bijan641 on January 15, 2010, 08:04:09 PM
I can't get this mod to return anything, even when I use the default return method.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Bijan641 on January 15, 2010, 08:11:59 PM
$parameters = array(
                'limit' => 1,
                'board' => array(13),
                'start' => 0,

            );

            ssi_multiBoardNews($parameters);


This is what I have. I was trying to return it to an array but when that wasn't working I just tried it standard and still got nothing.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Bijan641 on January 15, 2010, 08:40:14 PM
Yes it is. I've displayed posts from this forum using other SSI functions, but this one is much more flexible for what I want to do.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Bijan641 on January 15, 2010, 09:04:09 PM
I'm using 1.1.11 and the latest version of the mod.

As for the errors in the log, I would have no idea what to even look for really. I'm looking at it and there are thousands of errors.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Bijan641 on January 15, 2010, 09:23:57 PM
Parse error: syntax error, unexpected '=', expecting ')' in /homepages/12/d210086393/htdocs/forum/ssi_test.php on line 3
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Bijan641 on January 15, 2010, 09:33:57 PM
The output is nothing.

http://www.dotswoof.com/forum/ssi_test.php

The link in case you need it.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Bijan641 on January 15, 2010, 09:43:39 PM
Got an error:

Parse error: syntax error, unexpected ';', expecting ')' in /homepages/12/d210086393/htdocs/forum/ssi_test.php on line 4

Assuming you meant
<?php require('SSI.php');
$parameters = array(
  
'board' => array(13),
  
'output_type' => 'array'
);
$array ssi_multiBoardNews($parameters);
var_dump($array);
?>


When I did that, I get:

array(0) { }
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Bijan641 on January 15, 2010, 10:04:30 PM
array(1) {
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Bijan641 on January 15, 2010, 10:29:45 PM
Oh no. Thats really weird.

http://www.dotswoof.com/forum/index.php?board=13.0

Thats the link to the board. Right now there are two posts. Is there anything else on forums that might interfere with this function? I have added other mods.

By the way, thank you so much for the help, I really do appreciate it.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Bijan641 on January 16, 2010, 06:17:10 PM
Thank a lot. If you happen to figure something out that would be great. Thanks for all the help so far.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: tanshin on January 17, 2010, 04:16:04 PM
Hi there, I'm trying to work with this and so far it's going... okay. It's working, so that's a plus :P

My goal is to have only the avatar, author, and title to display (you know my setup from my questions earlier). I've been testing it over here:
http://nintendoaddict.com/ssi.php
My forum is here: smf.nintendoaddict.com

Any words of wisdom?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: tanshin on January 17, 2010, 05:03:16 PM
Who was that directed at?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: tanshin on January 17, 2010, 05:26:10 PM
Well I was kinda at a loss as to what I need to do to remove everything except the author, avatar, and post title. And then possibly have a colon between the author and post title, in addition to changing the limit to the length of the post title.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: tanshin on January 17, 2010, 05:59:37 PM
Here are the two SSI files. The _test file is the link I showed (I changed the name for purposes of readability), and SSI.php is the SSI file.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: tanshin on January 17, 2010, 06:21:01 PM
That's what I get for using Dreamweaver :P

Okay, so looking at this page: http://nintendoaddict.com/ssi.php
The items seem to have levels, however I'm assuming that is because of the styling elements that are in the code you provided?

EDIT: Oh! I just remembered something  O:) What about making the post titles link to the posts?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: tanshin on January 17, 2010, 06:53:49 PM
Ah, that looks better... however (I know, I'm probably royally getting on your nerves now) the post contents is being shown...
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: tanshin on January 17, 2010, 07:17:57 PM
Sorry, I must have said stuff wrong at first. I was just interested in having the avatar, author, and title since it is meant to be a little "preview" for people visiting the index. You can see what I mean here http://nintendoaddict.com with the Recent Reviews area.

EDIT: However, now the avatars aren't showing up  ;D And I know what you mean about frustration like that, I often feel the same way... only not with code since I don't code very often. I'm more of a designer...
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: tanshin on January 17, 2010, 07:48:41 PM
Alright, thank you so much! I doubt I'd have even gotten to this point if I didn't find this mod of yours. Now I feel like I can start skinning my forum! (I also feel like I was talking like Huck Finn because I was just reading it...)

But, go take some deep breaths... or watch some Ellen (that always cheers me up) or something so you aren't frustrated ;)
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: tanshin on January 17, 2010, 08:08:07 PM
I just realized you aren't in the US so... but I was referring to Ellen DeGeneres.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Neverhurry on January 24, 2010, 11:21:36 AM
Hi Arantor,

can you help me with the attachment images, i tried the following but it shows no attachment images.

another questions is how should i do to make it sort by last reply date desc (by default it is sorted by the first message date desc).

$parameters = array(
  'limit' => 25,
  'category' => array(30),
  'board_disp' => true,
  'category_disp' => true,
  'avatar' => 'left',
  'attachments' => 'thumbnail',
  'length' => 500,
);
ssi_multiBoardNews($parameters);


thanks in advance.  :D
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Neverhurry on January 24, 2010, 11:32:25 AM
Quote from: Arantor on January 24, 2010, 11:28:52 AM
Are all the boards in category 30 visible by guests?

It is sorted by first message date because it is *board news*, like ssi_boardNews does, it doesn't order topics by the last date but the order they were posted. If you change it you won't be able to uninstall it, btw.

No they are not visible by guests. Does it matter?
Too bad. I need sort by last reply, and will not uninstall it, can you still help?

But I think I can live with sorted by the first message.

3rd question, is it possible to add link to the first post title so that the users can conviniently click?

PS: i am using smf 2.0 rc2. attached is the SSI.php file.

thanks!
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Neverhurry on January 24, 2010, 12:35:57 PM
Quote from: Arantor on January 24, 2010, 12:23:40 PM
Yes, it does matter because unless they're visible by guests (as the mod's description states) they will NOT be visible.

You don't need to modify SSI.php to get that (like you don't need to modify any of the SSI functions to change their layout) - that's what output_type is for, to return as an array to get it in a different format.

I do not have time right now to go through this, though.

Thanks Arantor, i figured out the subject link.
Yes, return as an array is a good idea.

I changed all those boards are visible for guests, and guests have permission to see the attachment images. But still the attachment images don't show, that frustrates me the most.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Neverhurry on January 25, 2010, 03:06:02 AM
Quote from: Arantor on January 24, 2010, 01:48:46 PM
Can I see a link please?

yes, 21arte.com

the strange thing is, as a guest one can only see the name and the size of the attached pic. as an admin, one can't even see this info, nor the pic. but as a normal member, one can see the picture, very strange. I have given permission to all the groups including guests to see attached pictures. the boards are visible to all groups and guests. thank you arantor!

Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Neverhurry on January 25, 2010, 07:03:00 AM
Quote from: Arantor on January 25, 2010, 03:10:10 AM
Attachments are not visible to guests in that board, as proven by the fact that if a guest tries to view it from the link, it won't load but pushes instead to the login form.

i set those boards' permission profile to reply only, thus, even i gave permission to guests to view attachments, this permission doesn't affect boards with permission profile to reply only. I have to create a permission profile and give permission to guests to view attachment and chose the newly created permission profile to the boards. Now the guests can view the attachments.

Strange thing is: the admin can not see the attachment.  Who knows why and how to solve this weird problem? Could it be a bug? Thanks.....

:'( :'( :'(
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Neverhurry on January 25, 2010, 11:41:45 AM
Hi, arantor, when I tried today the code from you, i found out (perhaps) a bug, can you have a look?

the following code works:

$parameters = array(
  'limit' => 3,
  'board' => array(63,50),
);
ssi_multiBoardNews($parameters);


but the following code doesn't work (I narrowed the board chose to only one board, board id:63):

$parameters = array(
  'limit' => 3,
  'board' => array(63),
);
ssi_multiBoardNews($parameters);


Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Neverhurry on January 25, 2010, 12:53:30 PM
Hi Arantor,

I try to learn returning as an array, i studied your code (http://www.simplemachines.org/community/index.php?topic=355945.msg2460410#msg2460410)
and add at the last part some codes try to get the attachment, but i failed, can you help me? Thank you!



$parameters = array(
   'limit' => 3,
    'avatar' => 'left',
   'attachments'=> 'inline',
   'board'=> array(50,63),
   'category' => array(26),
   'output_type' => 'array',
);

// Don't need to state about board_disp and category_disp, we're not using them
$return = ssi_multiBoardNews($parameters);

foreach ($return['topics'] as $news)
{
echo '
         <div style="clear:left;">';
   if (isset($news['poster']['avatar']))
      echo '<img class="ssi_avatar" src="' . $news['poster']['avatar']['href'] . '" style="margin:0 1em 1em 1em; float: ' . $parameters['avatar'] . '" />';
   echo $news['poster']['link'], ': <a href="', $news['href'], '">', shorten_subject($news['subject'], 30), '</a></div>
   <div class="post" style="padding: 2ex 0;">', $news['body'], '</div>';

if (isset($news['attachments']))
echo '
<div class="ssi_attach" style="margin-top:0.3em;float:right">';
if ($news['attachments']['width'] > 0)
echo '
<img src="', $news['attachments']['href'], '" width="150px" height="" />';
}
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Neverhurry on January 25, 2010, 01:46:26 PM
Quote from: Arantor on January 25, 2010, 01:22:02 PM
Right, you telling me it doesn't work doesn't help me to fix it at all, not one iota. What does it actually do and what do you think it's supposed to do?

I put the code inside a PortaMX's php block now, but it shows nothing, and it doesn't give any error info either.

I would like to learn how returning as an array works.

I would like to see 3 topics with avatar, poster name, short subject, body of the first post, and attachment images (width=150px, float to right). thanks!  :)
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Neverhurry on January 25, 2010, 03:44:27 PM
Quote from: Arantor on January 25, 2010, 02:14:01 PM
For that one board only?

Link would be handy to the two boards you've been trying to access.

Links are:
http://21arte.com/index.php?board=50.0
http://21arte.com/index.php?board=63.0

Did see see this post? Is it a bug? http://www.simplemachines.org/community/index.php?topic=355945.msg2473989#msg2473989
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Neverhurry on January 25, 2010, 03:56:17 PM
I see.  :D
But what should I do if i want news from just one board, in this case, from Board id=50?
This mod is a very very useful. I wish you success and that a lot of people will use it. Thank you for this great mod.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Neverhurry on January 25, 2010, 05:43:22 PM
Quote from: Arantor on January 25, 2010, 04:01:46 PM
If you want it from just one board, it's fine but it's still subject to the age restriction too.

array(50) would work, and I think even just using 'board' => 50, would work too, but it's been a while.

i tried the following code, it shows the avatar, short subject, first post body, but no attachment images:

$parameters = array(
   'board'=> array(50,63),
   'limit' => 3,
    'avatar' => 'left',
   'attachments'=> 'inline',
   'output_type' => 'array',
);

// Don't need to state about board_disp and category_disp, we're not using them
$return = ssi_multiBoardNews($parameters);

foreach ($return['topics'] as $news)
                  {
echo '
         <div style="clear:left;">';
   if (isset($news['poster']['avatar']))
      echo '<img class="ssi_avatar" src="' . $news['poster']['avatar']['href'] . '" style="margin:0 1em 1em 1em; float: ' . $parameters['avatar'] . '" />';
   echo $news['poster']['link'], ': <a href="', $news['href'], '">', shorten_subject($news['subject'], 30), '</a></div>
   <div class="post" style="padding: 2ex 0;">', $news['body'], '</div>';
                 
       if (isset($news['attachments']))               
                     echo '
         <div class="ssi_attach" style="margin-top:0.3em;float:right;">';
                  if ($news['attachments']['width'] > 0)
                     echo '
            <img src="', $news['attachments']['href'], '" width="150px" height="" />';         
                  }


I tried both  'board'=> array(50), and  'board'=> 50, but it gives no result, no error info, nothing.

is "$news['attachments']" wrong? - i am not sure about it, i just wrote it intuitively, i might have been wrong of course, i don't know much about PHP.

Last, http://www.simplemachines.org/community/index.php?topic=355945.msg2473705#msg2473705
about the strange thing that as an admin, i can't view attachment images... is it a smf bug?

i really appreciate your help.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Neverhurry on January 30, 2010, 06:34:51 AM
Hi Arantor:

in SSI.php line 2195:

            'link' => '<a href="' . $scripturl . '?topic=' . $row['id_board'] . '.0">' .

I suppose that "topic" should be "board"?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: tanshin on February 01, 2010, 06:10:50 PM
Guess who's back :P

So, I have one final question for this. I plan to zebra stripe the output of ssi with three styles. How would I go about doing this?

EG:
style1
style2
styleLast
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: tanshin on February 02, 2010, 03:30:35 PM
If you still have the link to my site, http://nintendoaddict.com, you can get a pretty good idea as to what I mean. It exists both in the main section, as well as the review sidebar block.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: tanshin on February 02, 2010, 04:15:11 PM
Right now for the latest news area I'm using a modification of the loop. I believe this is the whole section:

<?php $c 0;?>
    <?php if(have_posts()): ?><?php while (have_posts()) : the_post(); ?>
                    <?php $c++;
if( $c == $wp_query->post_count $extra_class 'newslast';
elseif( $c == $extra_class 'newstwo';
else $extra_class 'newsone';
?>

    <div <?php post_class($extra_class?> id="post-<?php the_ID(); ?>">
        <div class="latestNewsDate"><?php the_time('l, M jS, Y - g:i A'); ?></div>
                        <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="latestNewsTitle"><?php the_title(); ?></a>
    <div class="latestNewsText">
<?php the_content(); ?>
            <p class="tag">
<?php _e('Under&#38;#58;'); ?> <?php the_category(', '?>
</p>
    </div>
                    </div>
    <?php endwhile; ?>


As for the recent reviews area, I am just doing that manually since reviews aren't very frequent, however I'd like to use the same styles from that.
- latestPostsEntry
- latestPostsEntry2
- latestPostsEntryEnd
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Neverhurry on February 04, 2010, 11:51:58 AM
Hi Arantor,

if there are image tags [img][/img] inside $news['body'] (message content), and it happens to be a big picture, then the board news block will be broken, is there a way to resize those picture to a width, for example, equals 100px? Can you help? Many thanks in advance.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: KensonPlays on February 04, 2010, 12:55:05 PM
Quote from: Arantor on December 26, 2009, 11:36:28 AM
:)

If there's any other features I could look at including, please do let me know. Icons were very much a last minute thing, I never actually planned to include them originally.

Well, maybe a bigger mod for easily including SSI for those complete newbs who don't know the code and are scared of editing/messing it up!
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Neverhurry on February 04, 2010, 12:59:30 PM
Quote from: Arantor on February 04, 2010, 12:39:29 PM
Not reliably, no, there isn't, except disabling them, or forcing scrollbars.

Too bad!  :'(  I believe many who is going to use this mod will come across this problem.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: tanshin on February 06, 2010, 02:54:07 PM
Hey there, so the SSI file only seems to be picking up new threads, rather than any post or reply.

Attached is the code (the include is in my index template file).
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: tanshin on February 06, 2010, 03:46:54 PM
Oh, alright then. I thought there was an option I was missing :P

Oh well, I can live with the way it works now.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Mick. on February 06, 2010, 10:51:09 PM
Odd....

I can view only images hosted somewhere else as admin....but if i logout, i can view uploaded images just fine.

$parameters = array(
  'limit' => 5,
  'board' => array(296,2297,298,299,300,301,302,303),
  'board_disp' => true,
  'category_disp' => true,
  'avatar' => 'right',
  'attachments' => 'inline',
 
 
);
ssi_multiBoardNews($parameters);


http://www.chevyavalancheclub.com/av_registry.php
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Mick. on February 07, 2010, 09:50:38 AM
Quote from: Arantor on February 07, 2010, 04:52:21 AM
The attachments, as the mod's description says, must be visible to guests in order for them to show up, since it uses the regular attachments code.

Gotcha. 

The mod works for my liking anyways.  Thanx Arantor.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Mick. on February 13, 2010, 03:49:29 PM
Is there a way to show a certain amount of characters...like breadcrumbs?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Mick. on February 13, 2010, 03:52:18 PM
I found it ;)

$parameters['length']
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: program5 on February 23, 2010, 11:53:24 AM
I am using the code below.
Is it possible to show the first attachment only ? If yes, please tell me how.
Regards

$parameters = array(
  'limit' => 5,
  'board' => array(1,2),
  'category' => array(3),
  'board_disp' => true,
  'category_disp' => true,
  'avatar' => 'left',
  'attachments' => 'thumbnail',
  'length' => 50,
  );
ssi_multiBoardNews($parameters);
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: program5 on February 24, 2010, 01:31:51 PM
Arantor,

I know You dont (officially) provide support for Your mods but You still help people.
This is much appreciated.

Thank You :)
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: kizer on March 19, 2010, 01:45:52 AM
Wow I can't believe I haven't seen this before. I was trying to create this before and well I was told it didn't work. Now I see why. ;)

I do have a question I'm trying to look through your SSI.php mod and I'd really like to wrap the output of each in this.

<div class=front>
the post info here
</div>

However looking through every line there is in that code man it makes it really hard.

This is an example of what I'm talking about.
http://www.links4jeeps.com/index.php?custom=yes&TID=custom-l4jwriteup

Of course I wanted it to be news related and basically in this format, but with the box around it which is my call to the <div class=front>
http://www.links4jeeps.com/forum/ssi_test2.php

I'm sure I can tinker around with this a while and figure things out, but I'm just having issues figuring out the echo portion of the code. Meaning I'd like it to output exactly what your example is, but it appears I have to do it in Echo in order to wrap the div around it.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Neverhurry on March 24, 2010, 08:29:40 AM
Quote from: BlueDevil on February 06, 2010, 10:51:09 PM
Odd....

I can view only images hosted somewhere else as admin....but if i logout, i can view uploaded images just fine.

$parameters = array(
  'limit' => 5,
  'board' => array(296,2297,298,299,300,301,302,303),
  'board_disp' => true,
  'category_disp' => true,
  'avatar' => 'right',
  'attachments' => 'inline',
 
 
);
ssi_multiBoardNews($parameters);


http://www.chevyavalancheclub.com/av_registry.php

Blue Devil, I got the same problem as an admin, those attached images aren't shown to admin. This is very weird. I hope somebody can fix it.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Neverhurry on March 29, 2010, 03:26:37 AM
Quote from: Arantor on January 25, 2010, 03:51:37 PM
No, it's not a bug.

There is a performance capping limit inside the code (just as there is in ssi_boardNews) to limit how many messages and topics can be examined. I really need to add a new option to the mod to remove that, I think, several people seem to assume it's a bug with the mod when it actually isn't.

Hi, Arantor. Can you tell me where is the "performance capping limit" inside the code (inside ssi_boardNews too)?

QuoteThe board that appears to be empty just has a message sufficiently old in comparison to the most recent that it's falling out of the capped area.

Does it mean, if there is a very old message in one board, then multiboardnews function will not work?

Thank you for your reply!

Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Neverhurry on April 03, 2010, 03:50:47 PM
Quote from: Arantor on March 29, 2010, 07:24:16 AM
That's correct. I would note that I no longer maintain this mod.

Arantor, thank you a bunch for your reply. I understand that you no longer maintain this mod and will respect it. I hope that the new developer of this mod can give support.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Robbo_ on April 04, 2010, 12:34:49 AM
I am still working my way through all the mods. When I get to this one I will reply to your posts.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Neverhurry on April 10, 2010, 05:56:07 AM
Quote from: Arantor on March 29, 2010, 07:24:16 AM
That's correct. I would note that I no longer maintain this mod.

Hi, Robbo_, since Arantor doesn't maintain this mod no longer, could you pls tell me

I asked Arantor this question and he said it is correct.
QuoteDoes it mean, if there is a very old message in one board, then multiboardnews function will not work?

Do you think, if I remove some very old messages in that board, could it help to make multiboardnews to get the latest topics from that board? Thanks a lot for reply.



Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Mick. on May 11, 2010, 12:56:44 PM
So Arantor Robbo, i really like the mod.  Been using it since released.

I wanted to add more posts without enlarging the page a mile a high.

The solution?, a scroll bar.

$parameters = array(
  'limit' => 15,
  'board' => array(1,2),
  'category' => array(12),
  'board_disp' => true,
  'category_disp' => true,
  'avatar' => 'left',
  'icon' => 'thumbup',
);
ssi_multiBoardNews($parameters);



Add this to it...
<div style="
width: 600px;
height: 500px;
overflow: auto;">Your links.</div>


It looks like this...
echo;
<div style=" width: 600px; height: 500px; overflow: auto;">';
$parameters = array(
  'limit' => 15,
  'board' => array(1,2),
  'category' => array(12),
  'board_disp' => true,
  'category_disp' => true,
  'avatar' => 'left',
  'icon' => 'thumbup',
);
ssi_multiBoardNews($parameters);
echo'
</div>';



See it in action.... www.chevyavalancheclub.com

Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Robbo_ on May 11, 2010, 09:59:21 PM
A better way would be to add a parameter to allow for a set height and/or width. Then have the function created the container for scrolling.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: kizer on May 12, 2010, 11:41:59 AM
I have to questions. Keep in mind I'm not a PHP programmer more or less a look at things and try to figure them out while breaking them 1500 times.

1. Is it possible to change the alt tag on the thumb to say something of the fact. Click here to view entire topic.
2. On the bread crumbs aka .... could we change it so something like ..... [See Entire Post] of course making the [See Entire Post] clickable to the actual topic?

I'm sure both of those are probably burried in the SSI file somewhere.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Neverhurry on May 16, 2010, 10:58:25 AM
Quote from: Robbo_ on May 11, 2010, 09:59:21 PM
A better way would be to add a parameter to allow for a set height and/or width. Then have the function created the container for scrolling.

It sounds very interesting, could you provide an example? thanks.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Neverhurry on May 16, 2010, 11:00:52 AM
Quote from: bluedevil on May 11, 2010, 12:56:44 PM
So Arantor Robbo, i really like the mod.  Been using it since released.

I wanted to add more posts without enlarging the page a mile a high.

The solution?, a scroll bar.


I went to your site to check, not bad, but a perfect solution will be decent pagination. But sadly I am not a php coder, maybe Robbo can help?

I have another question: when I set it to show 150 topics, but in reality it shows only 90 posts, why? (I set it to a higher number eg 300, but it doesn't help, it show only 90 posts) Thanks in advance.

Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Neverhurry on May 16, 2010, 11:07:22 AM
Quote from: Neverhurry on March 29, 2010, 03:26:37 AM
Quote from: Arantor on January 25, 2010, 03:51:37 PM
No, it's not a bug.

There is a performance capping limit inside the code (just as there is in ssi_boardNews) to limit how many messages and topics can be examined. I really need to add a new option to the mod to remove that, I think, several people seem to assume it's a bug with the mod when it actually isn't.

Hi, Arantor. Can you tell me where is the "performance capping limit" inside the code (inside ssi_boardNews too)?


Can anybody help me with some clue? I need it very much.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Neverhurry on May 16, 2010, 11:17:10 AM
Ok, Arantor, I understand, no way to make a pagination within the function.
Just in case who knows where is the performance capping limit inside ssi_boardNews?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: HentzDynasty on July 17, 2010, 04:08:29 PM
So I've hit a snag.

1. The only board I'm able to view is 54 (the most recent board), all others just produce a blank space on my page.

2. I've tried to add a parameter so that within the board I choose to display, I can also say what topics I want displayed.

I'm not returning any error messages but the functionality isn't working either.

Attached are both the ssi function (which I trimmed down to just the function so there's not miles of code to look through) and the page in which I'm attempting to display the info.  The url is http://somethingelsetv.com/index_test.php


I'm new to php and am, therefore, probably making a stupid mistake.  Sorry in advance for all stupid questions I'll have, but I do appreciate any and all help.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: improv on August 05, 2010, 02:46:35 PM
Attachments not working here... hmmm

using it as : 'attachments' => 'thumbnail'
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: HentzDynasty on August 09, 2010, 12:53:14 AM
This do the trick?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: improv on August 17, 2010, 08:58:17 AM
I found a bug.
Linking to the category is wrong.
It currently links as: http:/page.org/index.php#c1
It should be: http://page.org/index.php?action=forum#c1
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Robbo_ on August 18, 2010, 12:38:29 AM
No, linking is fine. You are using a portal mod which is changing the default action and adding in the forum action. I don't have time to show you how to fix it sorry.

Hopefully I can give all my mods some attention some time next month.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: improv on August 18, 2010, 09:16:03 AM
Oh okay, didn't knew that.
I might attempt fixing it myself.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Legend Zero on August 28, 2010, 04:19:05 PM
I'm trying to use this function with a virtual Pagnation script I used with the original BoardNews function that worked like a charm. However, only the first posts will display and the pagnation seems to do nothing at all. Here is the code for the pagnation and the script here. Sorry if the echoing code is a bit random, but it's what I'm using to display each post in its own themed table.


<?php
// Number of items per page
$itemsPerPage 10;
// Board to get news from
$board 2;

// Number of news items
$newsNumber $smcFunc['db_query']('''
               SELECT COUNT(id_first_msg)
               FROM {db_prefix}topics
               WHERE id_board = {int:board}'
,
                array(
                    
'board' => $board,
                )
          );


// If the page is not set, assume page 1
if (!isset($_GET['page'])) $_GET['page'] = 1;
// Make sure page number is numeric
$_GET['page'] = (int) $_GET['page'];

// The page count - Total number of items divided by number per page
$newsPages ceil($newsNumber $itemsPerPage);
// First item
$firstItem = (($_GET['page'] - 1) * $itemsPerPage);

// Now, get the actual items
//$newsItems = ssi_boardNews($board, $itemsPerPage, $firstItem, 0, "array"); //board number, amount, start, length

$parameters = array(
  
'board' => array($board),
  
'output_type' => 'array',
);

$newsItems =  ssi_multiBoardNews($parameters);

// Loop trough all items
foreach($newsItems['topics'] as $newsItem
{
// Output the actual item
// Change this to suit your site
// ,print_r($newsItem['poster'])
//  <a href="', $newsItem['href'], '" />Permalink</a>

echo '
<div>
<table align="center" cellpadding="10" cellspacing="0" style="width: 600px">
<tr class="btop" height="40px">
<td>'
$newsItem['icon'],
$newsItem['subject'] ,'<br>
Posted by '
,$newsItem['poster']['link'],' at '$newsItem['time'], '.
</td>
</tr>
<tr class="bmiddle">
<td colspan="2">
<div class="post" style="padding: 1ex 0;">'
$newsItem['body'], '</div>
<br><hr style="margin: 0ex 0;" width="550px" /><br>
<table style="width: 150px">
<tr>
<td>
<table cellpadding="0" cellspacing="0" style="width: 50px; height: 70px">
<tr>
<td class="bbubblebg" style="height: 55px">'
$newsItem['comment_link'] ,'</td>
</tr>
<tr>
<td>
<a href="'
$newsItem['href'], '" />
<img alt="Comment" height="14" src="http://www.legendzero.com/images/bcomment.png" width="50" /></a></td>
</tr>
</table>
</td>
</tr>
</table>

</td>
</tr>
<tr class="bbottom" height="10">
<td colspan="2">
</td>
</tr>
</table>
<br>
<br>
</div>'
;
}

// Page numbers
echo '
<div align="right">
'
;
showPageNumbers($newsPages$_GET['page']);
echo 
'
</div>
'
;

function 
showPageNumbers($pages$current)
{
$pages = (int) $pages;
$current = (int) $current;

//If current page != 1, show '< Back' link
if ($current != 1)
{
$prevPage $current 1;
echo '
<a class="comment" href="?page='
$prevPage'">&lt; Back</a> ';

else
{
echo '
&lt; Back'
;
}

// Show links to all pages
for ($x 1$x <= $pages$x++)
{
// If this number is the current page, don't make number a link
if ($x == $current)
echo '
<b>'
$x'</b>';
else
echo '
<a class="comment" href="?page='
$x'">'$x'</a> ';
}

// If current page != last page, show 'Next >' link
if ($current != $pages)
{
$nextPage $current 1;
echo '
<a class="comment" href="?page='
$nextPage'">Next &gt;</a> ';
}
else
{
echo '
Next &gt;'
;
}

}
?>



Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Legend Zero on September 02, 2010, 04:18:39 PM
Ok, solved that issue, simple enough, but here's a new one.

I an trying to use the icon filter for the news to have different news feeds, for some reason "NewsBlog" works but "Orion" does not. News is by far the most popular catagory but Orion only has a handful of topics. Is there some sort of minimum for the filter to activate, because when trying to use "Orion" as a filter the function just returns a standard feed.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Oya on September 02, 2010, 05:14:03 PM
the actual feeds themselves do not support any kind of filter on icons since this mod uses smfs own feds
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Legend Zero on September 02, 2010, 08:06:50 PM
Feeds as in different copies of this function, bad choice of word.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: luuuciano on October 28, 2010, 10:11:42 AM
it will be too complicated to add a function... that limit the output by X days... and not X amount of posts?
(to build a weekly newsletter, resume, or something like that...)
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: ephobe on December 16, 2010, 09:20:46 AM
any idea when this will be compatible with 1.1.12?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Suki on December 16, 2010, 09:23:21 AM
its compatible, you can try  changing the 1.1.11 for 1.1.12 in the package-info.xml  file in the mod's zip

then  zip it again and install.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Mick. on December 26, 2010, 04:58:17 PM
Hey Robbo,

Is there a way not to allow image tags?  [img][/img]


As you can see i use it in my front page and a member posted several images.  Im not diggin' it.

http://www.chevyavalancheclub.com/index.php
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Mick. on December 29, 2010, 07:12:35 PM
Quote from: IncognitoMuse on December 26, 2010, 10:43:31 PM
Not when I wrote it, no. Though there's nothing to stop you grabbing the content by return array (which is one of the myriad options it has, see the output method parameter, rather than just outputting it. Once you do that, preg_replace('~<img [^>]+?~i', '', $content) on the given content... (obviously substitute the last variable there for whatever you loop through with)

Nevermind on that ;)   I changed the layout so the front page looks more a like a blog.  Thanx tho'
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Mick. on December 29, 2010, 07:16:56 PM
Here's a tip:

I wanted my front page to look like a blog. .....but for my likings, i wanted the 'subject' with bigger fonts, colored and clickable.

In Arantor's code in SSI.php file

find:

'subject' => $row['subject'],

and replace with:

'subject' => '<font color="#0474b4" size="5">'. '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $row['subject'] . '</a>' . '</font>',


Demo: link (http://www.chevyavalancheclub.com/index.php)

Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Mick. on December 31, 2010, 04:18:14 PM
small issue i cant crack it.  Im trying to make 'add this' work.

<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
<a href="http://www.addthis.com/bookmark.php?v=250&amp;username=xa-4d1e47940c3e817f" class="addthis_button_compact">Share</a>
<span class="addthis_separator">|</span>
<a class="addthis_button_preferred_1"></a>
<a class="addthis_button_preferred_2"></a>
<a class="addthis_button_preferred_3"></a>
<a class="addthis_button_preferred_4"></a>
</div>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=xa-4d1e47940c3e817f"></script>
<!-- AddThis Button END -->



But it still shares the main domain instead of the topic id.

I tried to use this in it but no luck... any ideas?

' . '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . '

demo.... CAC (http://www.chevyavalancheclub.com/index.php)
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Suki on January 01, 2011, 09:12:24 AM
Quote from: bluedevil on December 29, 2010, 07:16:56 PM
Here's a tip:

it will bemuch better if you use <span style="color:#0474b4; font-size:5em">  instead of <font>  cause that tag is deprecated


Quote from: bluedevil on December 31, 2010, 04:18:14 PM
small issue i cant crack it.  Im trying to make 'add this' work.



try using  $news['id']

' . '<a href="' . $scripturl . '?topic=' . $news['id']
. '.0">' . '
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Mick. on January 01, 2011, 09:35:49 AM
Thank you miss,...

I changed my mind as it may make the posts in the front page too busy.


as for the color code, using 1.5em is much better.  5em made it huge.  hehehhe 
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Darkness_ on January 12, 2011, 11:48:04 AM
Bluedevil,

Can I ask ou how you made the read more buttons ?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Mick. on January 12, 2011, 11:54:02 AM
Quote from: Darkness_ on January 12, 2011, 11:48:04 AM
Bluedevil,

Can I ask ou how you made the read more buttons ?
I'll post it tonight. I'm on my phone now ;)
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Darkness_ on January 12, 2011, 01:26:15 PM
Thank you very much :)
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Yukie on January 12, 2011, 07:24:05 PM
I'm encountering a slight problem (because I'm a total nub at this).
I'm using the Multi Board News function on both the index page (pulling topics from board #1) as well as another separate page (pulling topics from board #2). The index page works perfectly fine, but for the separate page, the number of comments and the "Write Comment" are missing. I also had to override the permissions for the content of board #2 to show up.
Board #1 and board #2 have the exact same settings and permission though, so I can't figure out what's wrong.

For my index page, I have:
<?php $parameters = array(
  
'limit' => 5,
  
'board' => array(2),
);
ssi_multiBoardNews($parameters); ?>


And for my separate page, I have:
<?php $parameters = array(
  
'limit' => 1,
  
'board' => array(15),
  
'perms_override' => true,
);
ssi_multiBoardNews($parameters); ?>


What am I doing wrong?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Darkness_ on January 15, 2011, 10:31:41 AM
Quote from: bluedevil on January 12, 2011, 11:54:02 AM
Quote from: Darkness_ on January 12, 2011, 11:48:04 AM
Bluedevil,

Can I ask ou how you made the read more buttons ?
I'll post it tonight. I'm on my phone now ;)

Bluedevil, I think you've forgot it :/

Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: luuuciano on January 15, 2011, 10:59:04 AM
Or he talks to much!
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Mick. on January 15, 2011, 12:28:29 PM
Sure, let me drop my personal business and post this for y'all this right minute.  Hang tight.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Darkness_ on January 16, 2011, 08:02:21 AM
I just said that because you said i'll drop it tonight.


But thank you in advance :)
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Mick. on January 16, 2011, 09:34:47 AM
I'm at my folks visiting. I'm leaving in an hour or so. I can't post the code via iPhone as I don't remember the code. I'll post it today ;) once I get home.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Darkness_ on January 16, 2011, 11:51:56 AM
Ok, waiting wit exsitement (don't know how to spell it :D )

Thank you.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Mick. on January 16, 2011, 02:19:26 PM
How to add a "Read More" link,....

Open SSI.php

Find:
$row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
$row['body'] .= '...';
}


Replace with:
$row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
$row['body'] .= '...' . '&nbsp;&nbsp;<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . '<strong>Read More</strong>' . '</a>';
}
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Darkness_ on January 16, 2011, 06:28:54 PM
Thank you very much
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Mick. on January 16, 2011, 06:32:28 PM
Quote from: Darkness_ on January 16, 2011, 06:28:54 PM
Thank you very much
No problem ;)
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Mick. on January 25, 2011, 02:01:26 PM
You know what would be cool? Adding a pagination system at the footer after 5....10...15 topics displayed. :P
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Mick. on January 25, 2011, 02:13:42 PM
Quote from: Arantor on January 25, 2011, 02:06:57 PM
You know what would be cool? :P Reading that I already discussed this... :P

It can't work without knowing the script it's part of, meaning that it's basically impossible/very difficult/not worth the effort given that scenario, when you can implement it in your own scripts for probably less effort than trying to use with this monster of a function.
hmmm, I didn't think it'll be difficult since the gallery and article mod uses a pagination system.
I do have a pagination script that I'm going to tinker with.  But thinking about it, I'm sure it will still use manual input to add topics to the second, third, etc pages.

I do like this mod and I'm surprised that it still under 1k downloads. This mod has lots of potential.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Masterd on January 26, 2011, 06:08:48 AM
Quote from: Mick G. on January 16, 2011, 02:19:26 PM
How to add a "Read More" link,....

Open SSI.php

Find:
$row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
$row['body'] .= '...';
}


Replace with:
$row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
$row['body'] .= '...' . '&nbsp;&nbsp;<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . '<strong>Read More</strong>' . '</a>';
}


This is hardcoded.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Mick. on January 26, 2011, 06:49:26 AM
Quote from: Masterd on January 26, 2011, 06:08:48 AM
Quote from: Mick G. on January 16, 2011, 02:19:26 PM
How to add a "Read More" link,....

Open SSI.php

Find:
$row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
$row['body'] .= '...';
}


Replace with:
$row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
$row['body'] .= '...' . '&nbsp;&nbsp;<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . '<strong>Read More</strong>' . '</a>';
}


This is hardcoded.
and your point is?

I hard code my forum as much as I want.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Mick. on January 26, 2011, 06:59:14 AM
Quote from: Arantor on January 26, 2011, 06:52:33 AM
What you really need is a [more] to set it up when you want it to appear.

/me is glad he already has one of those set up, not that he wrote that feature...

   Great idea. Wordpress has it.

You did yours in the bbc tags?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: henrik1782 on January 27, 2011, 05:31:54 PM
Hi...

Can anyone help me to get started with this mod. It sounds interesting but I have not figured out how to implement it. I am using SMF 2.0 RC4 and Curve theme.

Best regards
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: henrik1782 on January 27, 2011, 05:42:44 PM
Thanks Arator ... then i don't have to worry about implentation  ;)
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Mick. on January 27, 2011, 06:12:07 PM
Quote from: henrik1782 on January 27, 2011, 05:42:44 PM
Thanks Arator ... then i don't have to worry about implentation  ;)

I use it on portals too ;)
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Darkness_ on February 04, 2011, 11:42:44 AM
is it possible to get posts of a certain topic (id)?
if so, could someone tell me how.

Thanks in advance


(SMF 2.0 RC4 only this mod and simpleportal)
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Suki on February 04, 2011, 03:18:53 PM
true, on RC4 theres an SSI function called ssi_fetchPosts  you can use that func to, well, fetch :P  a single topic:

ssi_fetchPosts($post_ids, $override_permissions = false, $output_method = 'echo');

where $post_ids  is the id of the topic you want to fetch and it also support multiples id for multiples topics.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Biology Forums on February 20, 2011, 10:39:08 AM
Hey arantor, is there a way to show just attachments from all the boards and nothing else?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: i777Ares on March 06, 2011, 04:47:11 AM
trying to show attached images from boards 9 & 10.
attachments are viewable to guests really need this for my site
its a photoshop community so we post imagessssss lol
thank you for the help
$parameters = array(
  'limit' => 5,
  'board' => array(9,10),
  'board_disp' => true,
  'category_disp' => true,
  'avatar' => 'left',
  'attachments' => 'thumbnail',
  'length' => 50,
  );
ssi_multiBoardNews($parameters);
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: i777Ares on March 06, 2011, 05:00:48 PM
does not display attachments really need this to work please help
placed in php block of simple portal
smf 2.0 RC4
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: i777Ares on March 06, 2011, 05:02:52 PM
http://x-tremedesigns.net/
front page
the right side center
the left side center has the image in the post so i can do that but would rather the attachment to auto show
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: i777Ares on March 06, 2011, 05:08:28 PM
front page
the right side center
the left side center has the image in the post so i can do that but would rather the attachment to auto show
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Biology Forums on March 06, 2011, 05:12:19 PM
Quote from: i777Ares on March 06, 2011, 05:08:28 PM
front page
the right side center
the left side center has the image in the post so i can do that but would rather the attachment to auto show

Can you PLEASE send me the code on how you did this (see attachment). I've been trying to do that using the attachments people have attached for the longest time. I have the mod installed already.

Excellent site btw.

Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: i777Ares on March 06, 2011, 05:24:18 PM
Quote from: shuban on March 06, 2011, 05:12:19 PM
Quote from: i777Ares on March 06, 2011, 05:08:28 PM
front page
the right side center
the left side center has the image in the post so i can do that but would rather the attachment to auto show

Can you PLEASE send me the code on how you did this (see attachment). I've been trying to do that using the attachments people have attached for the longest time. I have the mod installed already.

Excellent site btw.


you have the board attachment mod

Quote from: Arantor on March 06, 2011, 05:11:34 PM
I'm not sure I understand what you mean, and to be honest I'm not sure what you want is very clear, or possible with this mod, but you might be lucky.

/me adds this to his private list of mods he wishes he'd never written.

i had to put the image in the post for it to show in the block if you look at one of the posts inside the forum you will see what i mean
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Biology Forums on March 06, 2011, 05:32:31 PM
Yes I have the board attachment mod installed and works. But can you send me the code you used specifically to have that scrolling this allow with the SSI call function?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: i777Ares on March 06, 2011, 05:44:24 PM
/Themes/default/BoardAttachments.template.php
Code (Find) Select
<?php
Code (Add Before) Select
<script type="text/javascript" src="crawler.js">
/*
Text and/or Image Crawler Script ©2009 John Davenport Scheuer
as first seen in http://www.dynamicdrive.com/forums/ username: jscheuer1
This Notice Must Remain for Legal Use
*/
</script>

Code (Find) Select
<table>
Code (Replace With) Select
<div class="marquee" id="mycrawler2"><table>
Code (Find) Select
</table>
Code (Replace With) Select
</table></div>
Code (Find) Select
?>
Code (Replace With) Select
?>
<script type="text/javascript">
marqueeInit({
uniqueid: 'mycrawler2',

inc: 5, //speed - pixel increment for each iteration of this marquee's movement
mouse: 'cursor driven', //mouseover behavior ('pause' 'cursor driven' or false)
moveatleast: 2,
neutral: 150,
savedirection: true
});
</script>

place attached file to root DONE
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Biology Forums on March 06, 2011, 05:49:18 PM
Crap! I just noticed you're using 2.0, 1.x doesn't have BoardAttachments.template.php.  :-\ :-\ :-\ :-\ :-\

Thanks anyways!
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: i777Ares on March 06, 2011, 05:51:21 PM
Quote from: Arantor on March 06, 2011, 05:40:47 PM
Quotei had to put the image in the post for it to show in the block if you look at one of the posts inside the forum you will see what i mean

This is why you need to give me more specific examples. You want me to spend my time trying to help you, you gotta give me more specifics than you are so far.
dude what else do you need to know
the problem: the php code will NOT show the attached image from the post but if I set  'length' => 500, then put the [img]http://x-tremedesigns.net/myfile/44949.jpg_thumb.png[/img]
in the post its self it will show the image but I am wanting it to show the image with out having to do this
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Biology Forums on March 06, 2011, 05:54:07 PM
Can you guide me to it?

The board attachments mod
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: i777Ares on March 06, 2011, 06:03:02 PM
Quote from: Arantor on March 06, 2011, 05:52:23 PM
Like the link you're telling me about that I should use as an example?
the info cycled in red is what you are seeing on front page as you can see I used the img tags to place image in the post so it will showon front page
because the $parameters = array(
  'limit' => 6,
  'board' => array(6,8,9,10,11),
  'board_disp' => false,
  'category_disp' => true,
  'attachments' => 'thumbnail',
  'length' => 500,
  'avatar' => 'false',
);
ssi_multiBoardNews($parameters);

does not show attachment image
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: i777Ares on March 06, 2011, 06:04:13 PM
Quote from: shuban on March 06, 2011, 05:54:07 PM
Can you guide me to it?

The board attachments mod
http://custom.simplemachines.org/mods/index.php?mod=2523
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: i777Ares on March 06, 2011, 06:29:17 PM
wow umm ok well then why can i not see it
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: i777Ares on March 06, 2011, 06:34:30 PM
what browser are you using firefox or IE
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: i777Ares on March 06, 2011, 06:49:27 PM
ok i see it so the problem is with permissions or admin group
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: i777Ares on March 06, 2011, 06:58:02 PM
the main admin account can not see this so that may be the coding 
because you cant change the permissions for the account
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Arantor on March 06, 2011, 07:01:21 PM
OK, I looked at the code again, and with what I know now that I didn't know over a year ago, I can see a bug for administrators.

Code (find) Select
if ($parameters['attachments'] != 'none' && !empty($modSettings['attachmentEnable']) && count(array_intersect($parameters['board'], boardsAllowedTo('view_attachments'))) > 0)

Code (replace) Select
if ($parameters['attachments'] != 'none' && !empty($modSettings['attachmentEnable']) && ($context['user']['is_admin'] || count(array_intersect($parameters['board'], boardsAllowedTo('view_attachments'))) > 0))

boardsAllowedTo is a strange function; it returns the list of boards as it should, except for administrators, though why it showed them to me is a mystery. Before anyone else asks, I don't have the power to update this modification and if for any reason it were returned to me, I would remove it from this site.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: i777Ares on March 06, 2011, 07:10:48 PM
wow Thank you so much that worked you should update the file and the mod for this.
it is the only problem I have seen ppl most talking about
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: i777Ares on March 06, 2011, 07:14:32 PM
wow dude...... whatever
its a great mod anyway
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Darkness_ on March 31, 2011, 10:52:05 AM
Using SMF 2 RC5

Using the code with custom action mod

<?php require_once("/*****SSI.php"); ?>
<?php
$parameters 
= array(
  
'limit' => 5,
  
'length' => 200,
  
'board' => array(40),
  
'category' => array(12),
  
'board_disp' => false,
  
'category_disp' => false,
);

ssi_multiBoardNews($parameters);


?>



But nothing is showing up for me :/ is it related because it is actually for an older version of smf (I don't think so, because it worked on a RC4)
or am I doing something wrong?

The Board Id and category id are both correct.


Maybe good to know i installed the mod ssi_topic to

Thanks in advance
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Darkness_ on March 31, 2011, 11:24:11 AM
www.amenna.nl/vizyon

But the geust don't see any boards or something.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Darkness_ on March 31, 2011, 11:29:18 AM
Yeah I just noticed that. I first thougt that there was a function build in custum actions to do that, but that was with simple portal.
Solved now, thanks for your fast reply.

And sry for not trying everything I could (I just didn't get on it, but when you asked the link to me, i noticed I didn't try that)
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Darkness_ on March 31, 2011, 11:33:42 AM
what can be the other reason?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: samozin on April 13, 2011, 07:37:27 AM
 hey guys i tried what u all told but i couldnt even get the result that (bluedevil) got
i wanted to show it with thumbnails but did work propably

any one can help ?
iam using smf 2.0 rc5

Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Masterd on April 14, 2011, 07:49:34 AM
Yes, it should look like this.

<?php 

require_once("SSI.php");

$parameters = array(
  
'limit' => 5,
  
'length' => 200,
  
'board' => array(40),
  
'category' => array(1),
  
'board_disp' => false,
  
'category_disp' => false,
  
'attachments' => 'thumbnail',
);

ssi_multiBoardNews($parameters);

?>
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: poveyjo on May 19, 2011, 07:40:17 PM
Does this work in 1.13?

I managed to install it by changing the version number in 1.13.  But I can't get it to display anything at all. Normal SSI still works fine.

When I search SSI.php for multiBoardNews there is no function in there.  Should one have been added?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Suki on May 20, 2011, 09:59:47 AM
Are you sure you installed the mod properly?


this code should appear in your SSIphp file:


// Arantor: ssi_multiBoardNews
function ssi_multiBoardNews($parameters)
{
global $scripturl, $db_prefix, $txt, $settings, $modSettings, $context, $smcFunc, $user_profile;

loadLanguage('Stats');

// Load the message icons - the usual suspects.
$stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
$icon_sources = array();
foreach ($stable_icons as $icon)
$icon_sources[$icon] = 'images_url';

$feed_types = array('rss', 'rdf', 'atom', 'none');
$attach_types = array('none', 'linkonly', 'thumbnail', 'inline');
$avatar_types = array('none', 'left', 'right');

// Checking off the parameters first
$parameters['limit'] = isset($parameters['limit']) ? max(1, (int) $parameters['limit']) : 5;
$parameters['start'] = isset($parameters['start']) ? max(0, (int) $parameters['start']) : 0;
$parameters['length'] = isset($parameters['length']) ? (int) $parameters['length'] : 0;
$parameters['perms_override'] = isset($parameters['perms_override']) ? (bool) $parameters['perms_override'] : false;
$parameters['attachments'] = isset($parameters['attachments']) ? (in_array($parameters['attachments'], $attach_types) ? $parameters['attachments'] : 'none') : 'none';
$parameters['avatar'] = isset($parameters['avatar']) ? (in_array($parameters['avatar'], $avatar_types) ? $parameters['avatar'] : 'none') : 'none';

$parameters['feed'] = isset($parameters['feed']) ? (array) $parameters['feed'] : array('none');
$parameters['feed'] = array_intersect($parameters['feed'], $feed_types);
if (count($parameters['feed']) == 0)
$parameters['feed'] = array('none');

$parameters['board'] = isset($parameters['board']) ? (array) $parameters['board'] : array(0);
$parameters['category'] = isset($parameters['category']) ? (array) $parameters['category'] : array(0);
$parameters['board_disp'] = isset($parameters['board_disp']) ? (bool) $parameters['board_disp'] : true;
$parameters['category_disp'] = isset($parameters['category_disp']) ? (bool) $parameters['category_disp'] : false;

$parameters['icon'] = isset($parameters['icon']) ? (array) $parameters['icon'] : array();
$parameters['icon'] = array_intersect(array_unique($parameters['icon']), $stable_icons);

$parameters['output_type'] = isset($parameters['output_type']) ? ($parameters['output_type'] == 'echo' ? 'echo' : 'array') : 'echo';

foreach ($parameters['board'] as $key => $value)
{
$value = (int) $value;
if ($value < 1)
unset ($parameters['board'][$key]);
else
$parameters['board'][$key] = (int) $value;
}

if (!empty($parameters['category']))
{
$parameters['category'] = array_unique((array) $parameters['category']);
foreach ($parameters['category'] as $key => $value)
{
$value = (int) $value;
if ($value < 1)
unset ($parameters['category'][$key]);
else
$parameters['category'][$key] = (int) $value;
}

if (count($parameters['category']) > 0)
{
$query = db_query("SELECT ID_BOARD FROM {$db_prefix}boards WHERE ID_CAT IN (" . implode(', ', $parameters['category']) . ")", __FILE__, __LINE__);
while($row = mysql_fetch_row($query))
$parameters['board'][] = $row[0];

mysql_free_result($query);
}
}

$parameters['board'] = array_unique($parameters['board']);

if (count($parameters['board']) == 0)
$parameters['board'] = array(0);

if (!$parameters['perms_override'])
{
// So we're checking the guest perms here. Note this can only be done from a PHP call.
// You can't do this from an external SSI type include (via $_GET) for obvious reasons!

$board_count = count($parameters['board']);

$board_limit = 1;
$where = 'FIND_IN_SET(-1, memberGroups)';
if ($board_count > 1)
{
$where = 'ID_BOARD IN (' . implode(', ', $parameters['board']) . ') AND ' . $where;
$board_limit = $board_count;
}

// So, either get all boards we asked for and check their membergroups,
// or we asked for nothing, so get the first board you find that is guest safe

$request = db_query("SELECT ID_BOARD FROM {$db_prefix}boards WHERE " . $where . " LIMIT " . $board_limit, __FILE__, __LINE__);
if (mysql_num_rows($request) == 0)
{
if ($output_method == 'echo')
die($txt['ssi_no_guests']);
else
return array();
}

$allowed_boards = array();
while($row = mysql_fetch_row($request))
$allowed_boards[] = $row[0];
mysql_free_result($request);

if ($board_count > 0)
$parameters['board'] = array_intersect($parameters['board'], $allowed_boards);
else
$parameters['board'] = $allowed_boards;

if (count($parameters['board']) == 0)
$parameters['board'] = array(0);
}

$icon = count($parameters['icon']) > 0 ? 'AND m.icon IN ("' . implode('", "', $parameters['icon']) . '")': '';

// Find the post ids.
$request = db_query("
SELECT ID_FIRST_MSG, icon
FROM {$db_prefix}topics AS t INNER JOIN {$db_prefix}messages AS m ON (t.ID_FIRST_MSG = m.ID_MSG)
WHERE t.ID_BOARD IN (" . implode(', ', $parameters['board']) . ")
{$icon}
ORDER BY ID_FIRST_MSG DESC
LIMIT " . $parameters['start'] . ", " . $parameters['limit'], __FILE__, __LINE__);
$posts = array();
while ($row = mysql_fetch_assoc($request))
$posts[] = $row['ID_FIRST_MSG'];
mysql_free_result($request);

if (empty($posts))
return array();

// Find the posts.
$request = db_query("
SELECT
m.icon, m.subject, m.body, IFNULL(mem.realName, m.posterName) AS poster_name, m.posterTime,
t.numReplies, t.ID_TOPIC, m.ID_MEMBER, m.smileysEnabled, m.ID_MSG, t.locked, t.ID_BOARD, b.name AS board_name, c.ID_CAT, c.name AS cat_name
FROM {$db_prefix}topics AS t
INNER JOIN {$db_prefix}messages AS m ON (m.ID_MSG = t.ID_FIRST_MSG)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
INNER JOIN {$db_prefix}boards AS b ON (t.ID_BOARD = b.ID_BOARD)
INNER JOIN {$db_prefix}categories AS c ON (b.ID_CAT = c.ID_CAT)
WHERE t.ID_FIRST_MSG IN (" . implode(', ', $posts) . ")
ORDER BY t.ID_FIRST_MSG DESC
LIMIT " . count($posts), __FILE__, __LINE__);
$return = array();
$posters = array();
$messages = array();
$last = 0;
while ($row = mysql_fetch_assoc($request))
{
// If we want to limit the length of the post.
if ($parameters['length'] > 0 && $func['strlen']($row['body']) > $parameters['length'])
{
$row['body'] = $func['substr']($row['body'], 0, $parameters['length']);

// The first space or line break. (<br />, etc.)
$cutoff = max(strrpos($row['body'], ' '), strrpos($row['body'], '<'));

if ($cutoff !== false)
$row['body'] = $func['substr']($row['body'], 0, $cutoff);
$row['body'] .= '...';
}

$row['body'] = parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MSG']);

// Check that this message icon is there...
if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']]))
$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? 'images_url' : 'default_images_url';

censorText($row['subject']);
censorText($row['body']);

$return['topics'][$row['ID_TOPIC']] = array(
'id' => $row['ID_TOPIC'],
'board' => array(
'id' => $row['ID_BOARD'],
'name' => $row['board_name'],
'href' => $scripturl . '?board=' . $row['ID_BOARD'] . '.0',
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_BOARD'] . '.0">' . $row['board_name'] . '</a>',
),
'category' => array(
'id' => $row['ID_CAT'],
'name' => $row['cat_name'],
'href' => $scripturl . '#c' . $row['ID_CAT'],
'link' => '<a href="' . $scripturl . '#c' . $row['ID_CAT'] . '">' . $row['cat_name'] . '</a>',
),
'message_id' => $row['ID_MSG'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
'subject' => $row['subject'],
'time' => timeformat($row['posterTime']),
'timestamp' => forum_time(true, $row['posterTime']),
'body' => $row['body'],
'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0',
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0">' . $row['numReplies'] . ' ' . ($row['numReplies'] == 1 ? $txt['smf_news_1'] : $txt['smf_news_2']) . '</a>',
'replies' => $row['numReplies'],
'comment_href' => !empty($row['locked']) ? '' : $scripturl . '?action=post;topic=' . $row['ID_TOPIC'] . '.' . $row['numReplies'] . ';num_replies=' . $row['numReplies'],
'comment_link' => !empty($row['locked']) ? '' : '<a href="' . $scripturl . '?action=post;topic=' . $row['ID_TOPIC'] . '.' . $row['numReplies'] . ';num_replies=' . $row['numReplies'] . '">' . $txt['smf_news_3'] . '</a>',
'new_comment' => !empty($row['locked']) ? '' : '<a href="' . $scripturl . '?action=post;topic=' . $row['ID_TOPIC'] . '.' . $row['numReplies'] . '">' . $txt['smf_news_3'] . '</a>',
'poster' => array(
'id' => $row['ID_MEMBER'],
'name' => $row['poster_name'],
'href' => !empty($row['ID_MEMBER']) ? $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] : '',
'link' => !empty($row['ID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['poster_name'] . '</a>' : $row['poster_name']
),
'locked' => !empty($row['locked']),
'is_last' => false,
);
$posters[$row['ID_MEMBER']][] = $row['ID_TOPIC'];
$messages[] = $row['ID_MSG'];
$last = $row['ID_TOPIC'];
}

mysql_free_result($request);

// Get all the attachments, but only if we actually want them
if ($parameters['attachments'] != 'none' && !empty($modSettings['attachmentEnable']) && count(array_intersect($parameters['board'], boardsAllowedTo('view_attachments'))) > 0)
{
$request = db_query("
SELECT
a.ID_ATTACH, a.ID_MSG, a.filename, IFNULL(a.size, 0) AS filesize, a.downloads,
a.width, a.height, IFNULL(thumb.ID_ATTACH, 0) AS ID_THUMB, thumb.width AS thumb_width, thumb.height AS thumb_height, m.ID_TOPIC
FROM {$db_prefix}attachments AS a
LEFT JOIN {$db_prefix}attachments AS thumb ON (thumb.ID_ATTACH = a.ID_THUMB)
INNER JOIN {$db_prefix}messages AS m ON (a.ID_MSG = m.ID_MSG)
WHERE a.ID_MSG IN (" . implode(', ', $messages) . ")
AND a.attachmentType = 0", __FILE__, __LINE__);
$temp = array();
while ($row = mysql_fetch_assoc($request))
{
$temp[$row['ID_ATTACH']] = $row;
if (!isset($attachments[$row['ID_MSG']]))
$attachments[$row['ID_MSG']] = array();
}
mysql_free_result($request);

// This is better than sorting it with the query...
ksort($temp);

foreach ($temp as $attach_single)
{
$attachment = array(
'href' => $scripturl . '?action=dlattach;topic=' . $attach_single['ID_TOPIC'] . '.0;attach=' . $attach_single['ID_ATTACH'],
'filename' => htmlspecialchars($attach_single['filename']),
'filesize' => round($attach_single['filesize'] / 1024, 2) . ' ' . $txt['smf211'],
'width' => $attach_single['width'],
'height' => $attach_single['height'],
'imgsize' => $attach_single['width'] > 0 ? $attach_single['width'] . 'x' . $attach_single['height'] : '',
'downloads' => $txt['attach_viewed'] . ' ' . $attach_single['downloads'] . ' ' . $txt['attach_times'],
);
$attachment['thumbnail'] = $attach_single['ID_THUMB'] == 0 ? false : array(
'href' => $scripturl . '?action=dlattach;topic=' . $attach_single['ID_TOPIC'] . '.0;attach=' . $attach_single['ID_THUMB'] . ';image',
'width' => $attach_single['thumb_width'],
'height' => $attach_single['thumb_height'],
);
$return['topics'][$attach_single['ID_TOPIC']]['attachments'][] = $attachment;
}
}

// Get all the avatars, but only if we actually want them, then attach to the posts!
if ($parameters['avatar'] != 'none')
{
if ($modSettings['avatar_action_too_large'] == 'option_html_resize' || $modSettings['avatar_action_too_large'] == 'option_js_resize')
{
$avatar_width = !empty($modSettings['avatar_max_width_external']) ? ' width="' . $modSettings['avatar_max_width_external'] . '"' : '';
$avatar_height = !empty($modSettings['avatar_max_height_external']) ? ' height="' . $modSettings['avatar_max_height_external'] . '"' : '';
}
else
{
$avatar_width = '';
$avatar_height = '';
}

$poster_ids = loadMemberData(array_keys($posters));
foreach ($poster_ids as $member)
{
$topic = $posters[$member]; // to get back to $return
$profile = $user_profile[$member];
$avatar = array(
'image' => $profile['avatar'] == '' ? ($profile['ID_ATTACH'] > 0 ? '<img src="' . (empty($profile['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $profile['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $profile['filename']) . '" alt="" class="avatar" border="0" />' : '') : (stristr($profile['avatar'], 'http://') ? '<img src="' . $profile['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($profile['avatar']) . '" alt="" class="avatar" border="0" />'),
'href' => $profile['avatar'] == '' ? ($profile['ID_ATTACH'] > 0 ? (empty($profile['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $profile['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $profile['filename']) : '') : (stristr($profile['avatar'], 'http://') ? $profile['avatar'] : $modSettings['avatar_url'] . '/' . $profile['avatar']),
);

if ($avatar['href'] > '')
foreach ($topic as $tid)
$return['topics'][$tid]['poster']['avatar'] = $avatar;

}
}

if (empty($return))
return $return;

$return['topics'][$last]['is_last'] = true;

$return['feed'] = array();

if (in_array('rss', $parameters['feed']))
$return['feed']['RSS'] = array(
'href' => $scripturl . '?action=.xml;sa=news;type=rss;boards=' . implode(',', $parameters['board']),
'link' => '<a href="' . $scripturl . '?action=.xml;sa=news;type=rss;boards=' . implode(',', $parameters['board']) . '">RSS</a>',
);

if (in_array('rdf', $parameters['feed']))
$return['feed']['RDF'] = array(
'href' => $scripturl . '?action=.xml;sa=news;type=rdf;boards=' . implode(',', $parameters['board']),
'link' => '<a href="' . $scripturl . '?action=.xml;sa=news;type=rdf;boards=' . implode(',', $parameters['board']) . '">RDF</a>',
);

if (in_array('atom', $parameters['feed']))
$return['feed']['Atom'] = array(
'href' => $scripturl . '?action=.xml;sa=news;type=atom;boards=' . implode(',', $parameters['board']),
'link' => '<a href="' . $scripturl . '?action=.xml;sa=news;type=atom;boards=' . implode(',', $parameters['board']) . '">Atom</a>',
);

if ($parameters['output_type'] != 'echo')
return $return;

foreach ($return['topics'] as $news)
{
if ($parameters['avatar'] != 'none' && isset($news['poster']['avatar']))
$news['body'] = '<img class="ssi_avatar" src="' . $news['poster']['avatar']['href'] . '" style="margin:0 1em 1em 1em; float: ' . $parameters['avatar'] . '" />' . $news['body'];

echo '
<div>
', ($parameters['category_disp'] ? '[' . $news['category']['link'] . ']' : ''), ($parameters['board_disp'] ? ' [' . $news['board']['link'] . ']' : ''), ' <a href="', $news['href'], '">', $news['icon'], '</a> <strong>', $news['subject'], '</strong>
<div class="smaller">', $news['time'], ' ', $txt[525], ' ', $news['poster']['link'], '</div>

<div class="post" style="padding: 2ex 0;">', $news['body'], '</div>

', ($parameters['perms_override'] ? '' : $news['link'] . ($news['locked'] ? '' : ' | ' . $news['comment_link'])), '
</div>';

if (!empty($news['attachments'])) {
$count = count($news['attachments']);
if ($count > 0) {
switch($parameters['attachments'])
{
case 'linkonly':
echo ' <ul>';
foreach ($news['attachments'] as $attach)
echo '
<li><a target="_blank" href="', $attach['href'], '">', $attach['filename'], '</a> (', ($attach['imgsize'] != '' ? $attach['imgsize'] . ', ' : ''), $attach['filesize'], ')</li>';
echo '
</ul>';
break;
case 'thumbnail':
foreach ($news['attachments'] as $attach)
{
echo '
<div style="float:left; display:block;">';
if ($attach['thumbnail'])
echo '
<img src="', $attach['thumbnail']['href'], '" width="', $attach['thumbnail']['width'], '" height="', $attach['thumbnail']['height'], '" />';
echo '
<ul>
<li><a target="_blank" href="', $attach['href'], '">', $attach['filename'], '</a></li>
<li>', $attach['filesize'], ($attach['imgsize'] != '' ? ', ' . $attach['imgsize'] : ''), '</li>
</ul>';
echo '
</div>';
}
break;
case 'inline':
foreach ($news['attachments'] as $attach)
{
echo '
<div style="float:left; display:block;">';
if ($attach['width'] > 0)
echo '
<img src="', $attach['href'], '" width="', $attach['width'], '" height="', $attach['height'], '" />';
echo '
<ul>
<li><a target="_blank" href="', $attach['href'], '">', $attach['filename'], '</a></li>
<li>', ($attach['imgsize'] != '' ? $attach['imgsize'] . ', ' : ''), $attach['filesize'], '</li>
</ul>
</div>';
}
break;
}
}
}

if (!$news['is_last'])
echo '
<hr style="margin: 2ex 0; clear:left;" width="100%" />';
}

// Now, what about feeds

if (count($return['feed']) > 0)
{
$feeds = array();
foreach ($return['feed'] as $feed)
$feeds[] = $feed['link'];
echo '
<hr style="margin: 2ex 0;" width="100%" />
<div class="smalltext">', implode(' | ', $feeds), '</div>';
}

}
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: mBoxhotel on September 28, 2011, 06:11:31 AM
I want to one pic/post . - -"
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: luuuciano on December 19, 2011, 06:15:44 PM
Quote from: bluedevil on January 15, 2011, 12:28:29 PM
Sure, let me drop my personal business and post this for y'all this right minute.  Hang tight.

Lol, it was just a joke...! :)

/me finding old posts through google > searching for multiboardnews
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: luuuciano on December 19, 2011, 06:25:37 PM
btw, this mod will work ok on a 2.0.1?
Will try it in a few minutes I think... but maybe someone knows if any string have changed, etc....

BTW2, any way to show a default avatar when the user has no avatar?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Suki on December 19, 2011, 08:32:17 PM
It should be compatible with 2.0.1

as for showing a default avatar, it depends, I don't know this mod, it has 2 options in the avatar array, it has an "image"  value that already contains the html to show the avatar and it has an href value that only has the url for the image, allowing you to write your custom img tag.

You just need to add a ternary in both values:


$avatar = array(
'image' => $profile['avatar'] == '' ? ($profile['ID_ATTACH'] > 0 ? '<img src="' . (empty($profile['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $profile['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $profile['filename']) . '" alt="" class="avatar" border="0" />' : '') : (stristr($profile['avatar'], 'http://') ? '<img src="' . $profile['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($profile['avatar']) . '" alt="" class="avatar" border="0" />'),
'href' => $profile['avatar'] == '' ? ($profile['ID_ATTACH'] > 0 ? (empty($profile['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $profile['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $profile['filename']) : '') : (stristr($profile['avatar'], 'http://') ? $profile['avatar'] : $modSettings['avatar_url'] . '/' . $profile['avatar']),
);


checking if the variable in empty, if it is, then add your default value, if not then print the variable

The code is complicated to read because it already has several ternaries but with enough patience you can add your default avatar.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: luuuciano on December 22, 2011, 01:18:33 PM
Thanks a lot Miss!
Ill will try it later (with more time than now)
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: luuuciano on December 26, 2011, 08:57:05 PM
Quote from: Suki on December 19, 2011, 08:32:17 PM
The code is complicated to read because it already has several ternaries but with enough patience you can add your default avatar.

That was a hell to me... but a friend of mine "translated" that shortway to this, and it worked great!
I would never have done it without his help


if ($profile['avatar'] == '') {
if ($profile['id_attach'] > 0) {
if (empty($profile['attachment_type'])) {
$href = $scripturl . '?action=dlattach;attach=' . $profile['id_attach'] . ';type=avatar';
} else {
$href = $modSettings['custom_avatar_url'] . '/' . $profile['filename'];
}
} else {
$href = '###############';
}
} else {
if (stristr($profile['avatar'], 'http://')) {
//$image = '<img src="' . $profile['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar" border="0" />';
$href = $profile['avatar'];
} else {
$href = $modSettings['avatar_url'] . '/' . htmlspecialchars($profile['avatar']);
}
}

$image = '<img src="' . $href .'" alt="" class="avatar" border="0" />';

$avatar = array( 'image' => $image, 'href' => $href);


On ############### you have to put the non avatar image url


BTW, there is no way to show the first X characters of each topic? as a resume?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Biology Forums on December 27, 2011, 12:33:25 AM
What would be a good way of using his mod?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Suki on December 27, 2011, 09:40:43 AM
@luuuciano  Yes, sometimes a couple of good old if/else  is better for readability than several ternaries.

You can s how X characters, for tha ti use this function:


function Truncate_String($string, $limit, $break = ' ', $pad = '...')
{
if(empty($limit))
$limit = 30;

/* return with no change if string is shorter than $limit */
if(strlen($string) <= $limit)
return $string;

/* is $break present between $limit and the end of the string? */
if(false !== ($breakpoint = strpos($string, $break, $limit)))
if($breakpoint < strlen($string) - 1)
$string = substr($string, 0, $breakpoint) . $pad;

return $string;
}



@shuban  this mod acts the same as the SSI boardnews function, it just adds more parameters and the possibility to include multiple board the fetch the news from, if you don't have a frontpage or something similar then this mod is not for you.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: luuuciano on December 27, 2011, 01:33:40 PM
Quote from: Suki on December 27, 2011, 09:40:43 AM
You can s how X characters, for tha ti use this function:


function Truncate_String($string, $limit, $break = ' ', $pad = '...')
{
if(empty($limit))
$limit = 30;

/* return with no change if string is shorter than $limit */
if(strlen($string) <= $limit)
return $string;

/* is $break present between $limit and the end of the string? */
if(false !== ($breakpoint = strpos($string, $break, $limit)))
if($breakpoint < strlen($string) - 1)
$string = substr($string, 0, $breakpoint) . $pad;

return $string;
}



Mmmmm, but how to use it in the context of ssi_multiBoardNews ?
Because it is not using/getting the 1st topic message content?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: luuuciano on December 27, 2011, 01:36:57 PM
Quote from: shuban on December 27, 2011, 12:33:25 AM
What would be a good way of using his mod?

Im using it to just output the code, then I use that code on a newsletter made by hand (its a section showing the latest x topics)

BTW... here it is the code Im using, maybe someone find it useful or something...:

<!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>
<link rel="shortcut icon" href="http://ikes.com.ar/favicon.ico" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<html>
<?php
require("./SSI.php");

$parameters = array(
  
'limit' => 16,
//  'board' => array(9,4,39,40,41,42,43,44,45,46,47,48),
  
'board' => array(4,5,9,10,11,12,13,19,20,22,25,26,27,31,32,33,34,39,40,41,42,43,44,45,46,47,48,49,51,52,53),
//  'category' => array(2),
  
'board_disp' => true,
  
'category_disp' => true,
  
'avatar' => 'left',
//  'icon' => 'thumbup',
   
'output_type' => 'array',
);

$return ssi_multiBoardNews($parameters);

echo 
'


<h1 style="font-size:20px;font-weight:bold;color:#CC6600;font-family:arial;line-height:110%; margin-bottom:0;">Últimos 16 temas creados en el foro:</h1>
'
;

foreach (
$return['topics'] as $news)
{
   echo 
'
         <p style="font-size:10px;color:#666666;line-height:110%;font-family:verdana; text-align:left;padding:10px;width:210px;height:105px;float:left;">'
;
   if (isset(
$news['poster']['avatar']))
      echo 
'<img src="' $news['poster']['avatar']['href'] . '" style="margin:0 1em 1em 1em; float: ' $parameters['avatar'] . '" />';
   echo 
"Tema iniciado por " $news['poster']['link'], ':<br>
<a href="'
$news['href'], '">'shorten_subject($news['subject'], 80), '</a>
</p>'
;
}

?>


<br style="clear:both;">

</body>
</html>


It have all the css inline, because it will be used on an email newsletter
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Suki on December 27, 2011, 01:39:57 PM
the funciton itselg has some parameters:

Truncate_String($string, $limit, $break = ' ', $pad = '...')

$string means exactly that, a string, in this case it will be the new's title.

$limit is just and int on how many characters you want to display.

$break its just an empty space, this avoids half cut off words.

$pad is the thing that will appear at the end of the cut off string.


to use it you just need to do this:

'subject' => $row['subject'],

'subject' => Truncate_String($row['subject'], 10, ' ', '...'),
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: luuuciano on December 27, 2011, 05:01:43 PM
Oh, but... that will truncate the topic subject?
I mean to ad a content resume... something like:

AVATAR
AVATAR
AVATAR
Here the topic subjet, by someonelse.
"Here the little resume, first X characters of 1st message content... Here the little resume, first X characters of 1st message content... Here the little resume, first X characters of 1st message content... Here the little resume, first X characters of 1st message content......"
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Suki on December 27, 2011, 05:52:47 PM
then apply the function the news body.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: luuuciano on December 27, 2011, 07:39:56 PM
Quote from: Suki on December 27, 2011, 05:52:47 PM
then apply the function the news body.

Welll , I have tried this:

<!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>
<link rel="shortcut icon" href="http://ikes.com.ar/favicon.ico" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<html>
<?php

require("./SSI.php");

$parameters = array(
  
'limit' => 16,
//  'board' => array(9,4,39,40,41,42,43,44,45,46,47,48),
  
'board' => array(4,5,9,10,11,12,13,19,20,22,25,26,27,31,32,33,34,39,40,41,42,43,44,45,46,47,48,49,51,52,53),
//  'category' => array(2),
  
'board_disp' => true,
  
'category_disp' => true,
  
'avatar' => 'left',
//  'icon' => 'thumbup',
   
'output_type' => 'array',
'body' => $row['body'],
'body' => Truncate_String($row['body'], 100' ''...'),
);

$return ssi_multiBoardNews($parameters);

echo 
'


<h1 style="font-size:20px;font-weight:bold;color:#CC6600;font-family:arial;line-height:110%; margin-bottom:0;">Últimos 16 temas creados en el foro:</h1>
'
;

foreach (
$return['topics'] as $news)
{
   echo 
'
         <p style="font-size:10px;color:#666666;line-height:110%;font-family:verdana; text-align:left;padding:10px;width:210px;height:105px;float:left;">'
;
   if (isset(
$news['poster']['avatar']))
      echo 
'<img class="ssi_avatar" src="' $news['poster']['avatar']['href'] . '" style="margin:0 1em 1em 1em; float: ' $parameters['avatar'] . '" />';
   echo 
"Tema iniciado por " $news['poster']['link'], ':<br>
<a href="'
$news['href'], '">'shorten_subject($news['subject'], 80), '</a><br>
$news['body'] . '
</p>'
;
}

?>


<br style="clear:both;">

</body>
</html>


and added the Truncate_String to the SSI file... but its showing *all* the body content, not truncating it... maybe I did something wrong?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Suki on December 27, 2011, 07:57:03 PM
You're adding the function to one of the parameters:

'body' => $row['body'],
'body' => Truncate_String($row['body'], 100, ' ', '...'),

It is too early for that, $row doesn't even exist yet and will never exist since it belongs in the query code.

dismiss all of that and just add the function to the actual news body:

$news['body']
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: luuuciano on December 27, 2011, 09:11:36 PM
mmmm, this should work?

<!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>
<link rel="shortcut icon" href="http://ikes.com.ar/favicon.ico" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<html>
<?php

require("./SSI.php");

$parameters = array(
  
'limit' => 16,
//  'board' => array(9,4,39,40,41,42,43,44,45,46,47,48),
  
'board' => array(4,5,9,10,11,12,13,19,20,22,25,26,27,31,32,33,34,39,40,41,42,43,44,45,46,47,48,49,51,52,53),
//  'category' => array(2),
  
'board_disp' => true,
  
'category_disp' => true,
  
'avatar' => 'left',
//  'icon' => 'thumbup',
   
'output_type' => 'array',
//'body' => $row['body'],
//'body' => Truncate_String($row['body'], 100, ' ', '...'),
);

$return ssi_multiBoardNews($parameters);

echo 
'


<h1 style="font-size:20px;font-weight:bold;color:#CC6600;font-family:arial;line-height:110%; margin-bottom:0;">Últimos 16 temas creados en el foro:</h1>
'
;

foreach (
$return['topics'] as $news)
{
   echo 
'
         <p style="font-size:10px;color:#666666;line-height:110%;font-family:verdana; text-align:left;padding:10px;width:210px;height:105px;float:left;">'
;
   if (isset(
$news['poster']['avatar']))
      echo 
'<img class="ssi_avatar" src="' $news['poster']['avatar']['href'] . '" style="margin:0 1em 1em 1em; float: ' $parameters['avatar'] . '" />';
   echo 
"Tema iniciado por " $news['poster']['link'], ':<br>
<a href="'
$news['href'], '">'shorten_subject($news['subject'], 80), '</a><br>
Truncate_String($news['body'], 100' ''...') . '
</p>'
;
}

?>


<br style="clear:both;">

</body>
</html>


its just showing 1 item, and no body at all... it looks like gets broken when reaching the printing truncate function line?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Suki on December 28, 2011, 10:21:26 AM
it's showing 1 item because you are using $return['topics']

it should be just $return

foreach ($return as $news)
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: luuuciano on December 28, 2011, 11:06:49 AM
Mmmm, changed, but then it shows nothing...
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Suki on December 28, 2011, 11:08:27 AM
whats your full code?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: luuuciano on December 28, 2011, 02:25:49 PM
Here, attached
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Suki on December 29, 2011, 12:02:30 PM
where do you define both Truncate_String() and shorten_subject() ?

both functions must be either on the same file prueba.php or in some other file you need to call with a require_once()
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: luuuciano on December 29, 2011, 12:11:26 PM
Well, Truncate_String was added to the end of SSI
And shorten_subject... mmm no idea... it was on codes examples here... its not defined on SSI, but it worked (maybe its on smf core, required somewhere in SSI)
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Suki on December 29, 2011, 12:51:17 PM
Well I test it and got no errors with plain text message, also, if you are using html inside your messages it will give you errors since that function isn't built to support html tags, if you set for example 50 and the 50 character is inside an html tag it will cut the tag in the nearest space, thus breaking the html code.

You need to find a function that does support html code.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Biology Forums on December 29, 2011, 01:11:00 PM
Quote@shuban  this mod acts the same as the SSI boardnews function, it just adds more parameters and the possibility to include multiple board the fetch the news from, if you don't have a frontpage or something similar then this mod is not for you.

Thanks!
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: HeroicTofu on January 20, 2012, 10:08:47 PM
Hello. I'm currently using SMF Version 2.0.2 and saw this mod in glee only to find that the file is incompatible. Is there a quick and easy way to modify this to work with 2.0.2 or is there something that does about the same job that's already compatible? I'm in the process of learning PHP but I'm nowhere near good enough to know what the heck I'm looking for in mod scene. Any help would be appreciated  :D
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Arantor on January 20, 2012, 10:11:11 PM
The main code will work just fine. See http://wiki.simplemachines.org/smf/How_can_install_a_mod_that_doesn%27t_work_in_my_SMF_version and follow the main instructions (not the bit at the bottom that says 1.1.x only)
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: HeroicTofu on January 20, 2012, 10:44:55 PM
Quote from: Arantor on January 20, 2012, 10:11:11 PM
The main code will work just fine. See http://wiki.simplemachines.org/smf/How_can_install_a_mod_that_doesn%27t_work_in_my_SMF_version and follow the main instructions (not the bit at the bottom that says 1.1.x only)

This worked absolutely perfectly, thank you very much :D
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: luuuciano on January 21, 2012, 03:36:48 AM
woa...... Arantor... the former guy that had more post like none (almost)... sudenly have nearly 500???
What happened? there is a thread... or something to read/keep informed about that?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Arantor on January 21, 2012, 07:12:06 AM
You haven't been paying attention, I post a lot. Still nowhere near like I used to though ;)
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Mick. on January 21, 2012, 12:00:43 PM
Quote from: Arantor on January 21, 2012, 07:12:06 AM
You haven't been paying attention, I post a lot. Still nowhere near like I used to though ;)
Hahaha arrowtotheknee. I kew it was you. Welcome back brother.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Arantor on January 21, 2012, 12:05:18 PM
Thanks, though the way things are going (out here in RL), I doubt it'll have any permanence to it. :(
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Motorhed on April 23, 2012, 11:44:46 PM
Hey, quick question...

Is there any way to have this mod show only ONE attachment per post?

I want to have it so the first image attached to the post is shown, but not any others attached to that post...
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: sealanach on May 19, 2012, 08:17:48 AM
Hi there, I am newbie for SMF and this mod.

I installed 3 mods (advise by this topic (http://www.simplemachines.org/community/index.php?topic=417714.0)) but when i try this code (below) The forum show

QuoteFatal error: Call to undefined function ssi_multiBoardNews() in D:\xampp\htdocs\fullexp\Sources\Load.php(2151) : eval()'d code(20) : eval()'d code on line 20

echo'
<div align="center">
<table width="915px" border="0" cellpadding="2" cellspacing="2" bgcolor="f9f7f5">
<tr valign="top">
<td>
<div>
<h3 class="titlebg grid_header"><span class="left"></span>Blog Home - blog description goes here</h3>
<div class="roundframe grid">
';

$parameters = array(
'limit' => 1,
'board' => array(4),
'board_disp' => false,
'category_disp' => false,
'length' => 300,
'attachments' => 'none',
);

ssi_multiBoardNews($parameters);

echo'
</div>
</td>
<td>
<div>
<h3 class="titlebg grid_header"><span class="left"></span>Categories</h3>
<table class="tborder" width="100%">
<tr class="windowbg">
<td>
<li><a href="http://192.168.1.10/fullexp/index.php?action=blog">Blog Home</a></li>
<hr />
<li><a href="http://192.168.1.10/fullexp/index.php?action=category2">category 2</a></li>
<li><a href="http://192.168.1.10/fullexp/index.php?action=category3">category 3</a></li>
<li><a href="http://192.168.1.10/fullexp/index.php?action=category4">category 4</a></li>
<li><a href="http://192.168.1.10/fullexp/index.php?action=category5">category 5</a></li>
</td>
</tr>
</table>
<br />
<span class="lowerframe"><span><!-- // --></span></span>
<br class="clear">
</div>
</td>
</tr>
</table>
</div>
';


Please, give me advise. Thank and sorry in my poor English.

My SMF version is 2.0.2 no mod except 3 mods that i say.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: ormuz on July 25, 2012, 08:30:19 AM
How can I add the user website ($row['website_url']) to this mod?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Suki on July 25, 2012, 09:12:15 AM
You will need to modify the main query and add the avatar row, then when the data array is built you can ad the avatar param under member, is a bit messy since you have to take care of custom avatars, predefined avatars and attached avatars, take a lok at Load.php to see how is done.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: ormuz on July 25, 2012, 09:14:21 AM
Quote from: Suki on July 25, 2012, 09:12:15 AM
You will need to modify the main query and add the avatar row, then when the data array is built you can ad the avatar param under member, is a bit messy since you have to take care of custom avatars, predefined avatars and attached avatars, take a lok at Load.php to see how is done.

Is this for my question? I'm asking about the user website, not the avatar...

Thanks,
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Suki on July 25, 2012, 09:19:48 AM
oh, right hahaha

in that case you just need to fetch the column on the main query: 

IFNULL(mem.real_name, m.poster_name) AS poster_name, m.poster_time, mem.website_title, mem.website_url,

then on the member key:


'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => !empty($row['id_member']) ? $scripturl . '?action=profile;u=' . $row['id_member'] : '',
'link' => !empty($row['id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>' : $row['poster_name'],
'website' => !empty($row['website_url']) ? '<a href="' . $row['website_url'] . '">' . $row['website_title'] . '</a>' : '',
), ),

Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: ormuz on July 25, 2012, 09:31:25 AM
Thanks, it works! I've missed the main query when I was trying, damm!
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Mr. Jinx on September 27, 2012, 07:04:07 AM
Quote from: Suki on December 27, 2011, 09:40:43 AM
@luuuciano  Yes, sometimes a couple of good old if/else  is better for readability than several ternaries.

You can s how X characters, for tha ti use this function:


function Truncate_String($string, $limit, $break = ' ', $pad = '...')
{
if(empty($limit))
$limit = 30;

/* return with no change if string is shorter than $limit */
if(strlen($string) <= $limit)
return $string;

/* is $break present between $limit and the end of the string? */
if(false !== ($breakpoint = strpos($string, $break, $limit)))
if($breakpoint < strlen($string) - 1)
$string = substr($string, 0, $breakpoint) . $pad;

return $string;
}



@shuban  this mod acts the same as the SSI boardnews function, it just adds more parameters and the possibility to include multiple board the fetch the news from, if you don't have a frontpage or something similar then this mod is not for you.
Thanks for this example Suki! Exactly what I needed.
Maybe a nice feature for this Mulitple Boardnews mod?
Instead of just breaking the news item after x nummer of characters: add a custom string where the text should break.
This way an article writer can write some intro text. At the breakingpoint he just adds a custom string (for example '---').
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Suki on September 27, 2012, 08:15:03 AM
That function already includes a parameter to add a custom delimeter, by default is 3 dots
Many ssi functions does include a way to cut off text, all this function do is to add more options.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Deadfire on March 13, 2013, 01:49:10 AM
Been trying to figure this out for a little while now, and it seems the posts that I need to see are no longer in this thread for some reason.

Anyways the issue I have is making attachments display. and I think I must be doing it wrong,

Here is my code:


$parameters = array(
'limit' => 5,
'board' => array(1,2,3,4,5),
'output_type' => 'array',
'attachments'=> 'inline',
);
$return = ssi_multiBoardNews($parameters);
foreach ($return['topics'] as $news)
{
echo'
<article>
<h2>', $news['subject'], '</h2>
<p class="pubdate">written by ', $news['poster']['link'], ', <time datetime="2013-03-01T12:00:00-05:00">', $news['time'], '</time></p>
<p class="pubdate">posted in ', $news['board']['link'], '</p>
<hr />
<p>', $news['body'], '</p>';
if (isset($news['attachments']))               
                     echo '
            <p><img src="', $news['attachments']['href'], '" width="500px" height="500" /></p>';         
echo' <hr />
<p class="read">', $news['link'], ' | ', $news['new_comment'], '</p>
</article>
<hr class="article-divider" />';

if (!$news['is_last'])
echo '
<hr width="100%" />
<br />';
}


Now am I'm figuring $news['attachments']['href'] what would be correct?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Yağız... on March 13, 2013, 06:15:24 AM
Replace $return['topic'] with only $return in foreach. And replace every $news with $news['topic'] except attachments.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Deadfire on March 13, 2013, 11:38:07 AM
Quote from: Yağız... on March 13, 2013, 06:15:24 AM
Replace $return['topic'] with only $return in foreach. And replace every $news with $news['topic'] except attachments.

That just gives me blank echos, as in there is no data that appears.


$parameters = array(
'limit' => 5,
'board' => array(1,2,3,4,5),
'output_type' => 'array',
'attachments'=> 'inline',
);
$return = ssi_multiBoardNews($parameters);
foreach ($return as $news)
{
echo'
<article>
<h2>', $news['topic']['subject'], '</h2>
<p class="pubdate">written by ', $news['topic']['poster']['link'], ', <time datetime="2013-03-01T12:00:00-05:00">', $news['topic']['time'], '</time></p>
<p class="pubdate">posted in ', $news['topic']['board']['link'], '</p>
<hr />
<p>', $news['topic']['body'], '</p>';
if (isset($news['attachments']))               
                     echo '
            <p><img src="', $news['attachments']['href'], '" width="150px" height="" /></p>';         
echo' <hr />
<p class="read">', $news['topic']['link'], ' | ', $news['topic']['new_comment'], '</p>
</article>
<hr class="article-divider" />';

if (!$news['topic']['is_last'])
echo '
<hr width="100%" />
<br />';
}
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Yağız... on March 13, 2013, 12:32:45 PM
Sorry, what you did was correct. But there is a problem with count(array_intersect($parameters['board'], boardsAllowedTo('view_attachments'))) > 0 statement. Maybe you should wait for the author or Arantor to fix this problem.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Arantor on March 13, 2013, 12:40:11 PM
Why is there a problem with that, exactly? It's a perfectly legitimate construct.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Yağız... on March 13, 2013, 12:56:26 PM
Quote from: Arantor on March 13, 2013, 12:40:11 PM
Why is there a problem with that, exactly? It's a perfectly legitimate construct.
When I remove this part from the line attachments are in the output. I tried it on a new install, didn't touch any permissions.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Arantor on March 13, 2013, 02:24:29 PM
That would imply the user who views the page does not have permission to view attachments in the board(s) in question...
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Yağız... on March 13, 2013, 03:41:18 PM
Quote from: Arantor on March 13, 2013, 02:24:29 PM
That would imply the user who views the page does not have permission to view attachments in the board(s) in question...
So why it doesn't show the attachments to an admin? :)
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Arantor on March 13, 2013, 04:21:57 PM
Oh, because boardsAllowedTo() has strange properties for admins.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Deadfire on March 13, 2013, 05:05:15 PM
Quote from: Arantor on March 13, 2013, 04:21:57 PM
Oh, because boardsAllowedTo() has strange properties for admins.

Wouldn't your fix here fix that issue though?

Quote from: Arantor on March 06, 2011, 07:01:21 PM
OK, I looked at the code again, and with what I know now that I didn't know over a year ago, I can see a bug for administrators.

Code (find) Select
if ($parameters['attachments'] != 'none' && !empty($modSettings['attachmentEnable']) && count(array_intersect($parameters['board'], boardsAllowedTo('view_attachments'))) > 0)

Code (replace) Select
if ($parameters['attachments'] != 'none' && !empty($modSettings['attachmentEnable']) && ($context['user']['is_admin'] || count(array_intersect($parameters['board'], boardsAllowedTo('view_attachments'))) > 0))

boardsAllowedTo is a strange function; it returns the list of boards as it should, except for administrators, though why it showed them to me is a mystery. Before anyone else asks, I don't have the power to update this modification and if for any reason it were returned to me, I would remove it from this site.

Just as well I can't view the attachment even as a guest, and I've checked to make sure that the permissions were set.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Arantor on March 13, 2013, 05:08:18 PM
That fix would fix that issue, yes.

What permissions, exactly, were set?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Deadfire on March 13, 2013, 05:48:46 PM
well I guess 'permission' would be better, Guests can view attachments.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Arantor on March 13, 2013, 05:49:47 PM
No, it's not one permission. It's the confluence of permissions/groups/profiles/boards. Thus, what *permissions* total have been set?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Deadfire on March 13, 2013, 06:04:46 PM
Well the board profiles are all that allow for guests (and everyone) to view attachments, Permissions for all the membergroups also allow to view attachments
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Arantor on March 13, 2013, 07:57:15 PM
Links to the SSI page would be useful at this point in time.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Deadfire on March 13, 2013, 08:10:14 PM
Quote from: Arantor on March 13, 2013, 07:57:15 PM
Links to the SSI page would be useful at this point in time.

roger :) I'll just limit to the ssi_multiBoardNews function unless you want it full


function ssi_multiBoardNews($parameters)
{
global $scripturl, $db_prefix, $txt, $settings, $modSettings, $context, $smcFunc, $user_profile;

loadLanguage('Stats');

// Load the message icons - the usual suspects.
$stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
$icon_sources = array();
foreach ($stable_icons as $icon)
$icon_sources[$icon] = 'images_url';

$feed_types = array('rss', 'rdf', 'atom', 'none');
$attach_types = array('none', 'linkonly', 'thumbnail', 'inline');
$avatar_types = array('none', 'left', 'right');

// Checking off the parameters first
$parameters['limit'] = isset($parameters['limit']) ? max(1, (int) $parameters['limit']) : 5;
$parameters['start'] = isset($parameters['start']) ? max(0, (int) $parameters['start']) : 0;
$parameters['length'] = isset($parameters['length']) ? (int) $parameters['length'] : 0;
$parameters['perms_override'] = isset($parameters['perms_override']) ? (bool) $parameters['perms_override'] : false;
$parameters['attachments'] = isset($parameters['attachments']) ? (in_array($parameters['attachments'], $attach_types) ? $parameters['attachments'] : 'none') : 'none';
$parameters['avatar'] = isset($parameters['avatar']) ? (in_array($parameters['avatar'], $avatar_types) ? $parameters['avatar'] : 'none') : 'none';

$parameters['feed'] = isset($parameters['feed']) ? (array) $parameters['feed'] : array('none');
$parameters['feed'] = array_intersect($parameters['feed'], $feed_types);
if (count($parameters['feed']) == 0)
$parameters['feed'] = array('none');

$parameters['board'] = isset($parameters['board']) ? (array) $parameters['board'] : array(0);
$parameters['category'] = isset($parameters['category']) ? (array) $parameters['category'] : array(0);
$parameters['board_disp'] = isset($parameters['board_disp']) ? (bool) $parameters['board_disp'] : true;
$parameters['category_disp'] = isset($parameters['category_disp']) ? (bool) $parameters['category_disp'] : false;

$parameters['icon'] = isset($parameters['icon']) ? (array) $parameters['icon'] : array();
$parameters['icon'] = array_intersect(array_unique($parameters['icon']), $stable_icons);

$parameters['output_type'] = isset($parameters['output_type']) ? ($parameters['output_type'] == 'echo' ? 'echo' : 'array') : 'echo';

foreach ($parameters['board'] as $key => $value)
{
$value = (int) $value;
if ($value < 1)
unset ($parameters['board'][$key]);
else
$parameters['board'][$key] = (int) $value;
}

if (!empty($parameters['category']))
{
$parameters['category'] = array_unique((array) $parameters['category']);
foreach ($parameters['category'] as $key => $value)
{
$value = (int) $value;
if ($value < 1)
unset ($parameters['category'][$key]);
else
$parameters['category'][$key] = (int) $value;
}

if (count($parameters['category']) > 0)
{
$query = $smcFunc['db_query']('', '
SELECT id_board FROM {db_prefix}boards WHERE id_cat IN ({array_int:cat_list})',
array(
'cat_list' => $parameters['category'],
)
);
while($row = $smcFunc['db_fetch_row']($query))
$parameters['board'][] = $row[0];

$smcFunc['db_free_result']($query);
}
}

$parameters['board'] = array_unique($parameters['board']);

if (count($parameters['board']) == 0)
$parameters['board'] = array(0);

if (!$parameters['perms_override'])
{
// So we're checking the guest perms here. Note this can only be done from a PHP call.
// You can't do this from an external SSI type include (via $_GET) for obvious reasons!

$board_count = count($parameters['board']);

$board_limit = 1;
$where = 'FIND_IN_SET(-1, member_groups)';
if ($board_count > 1)
{
$where = 'id_board IN ({array_int:board_list}) AND ' . $where;
$board_limit = $board_count;
}

// So, either get all boards we asked for and check their membergroups,
// or we asked for nothing, so get the first board you find that is guest safe

$request = $smcFunc['db_query']('', '
SELECT id_board
FROM {db_prefix}boards
WHERE ' . $where . '
LIMIT {int:limit}',
array(
'board_list' => $parameters['board'],
'limit' => $board_limit,
)
);
if ($smcFunc['db_num_rows']($request) == 0)
{
if ($output_method == 'echo')
die($txt['ssi_no_guests']);
else
return array();
}

$allowed_boards = array();
while($row = $smcFunc['db_fetch_row']($request))
$allowed_boards[] = $row[0];
$smcFunc['db_free_result']($request);

if ($board_count > 0)
$parameters['board'] = array_intersect($parameters['board'], $allowed_boards);
else
$parameters['board'] = $allowed_boards;

if (count($parameters['board']) == 0)
$parameters['board'] = array(0);
}

// Find the post ids.
$request = $smcFunc['db_query']('', '
SELECT id_first_msg, icon
FROM {db_prefix}topics AS t INNER JOIN {db_prefix}messages AS m ON (t.id_first_msg = m.id_msg)
WHERE t.id_board IN ({array_int:board_list})' . (count($parameters['icon']) > 0 ? '
AND m.icon IN ({array_string:icon})' : '') . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}' : '') . '
ORDER BY id_first_msg DESC
LIMIT ' . $parameters['start'] . ', ' . $parameters['limit'],
array(
'board_list' => $parameters['board'],
'is_approved' => 1,
'icon' => $parameters['icon'],
)
);

$posts = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$posts[] = $row['id_first_msg'];
$smcFunc['db_free_result']($request);

if (empty($posts))
return array();

// Find the posts.
$request = $smcFunc['db_query']('', '
SELECT
m.icon, m.subject, m.body, IFNULL(mem.real_name, m.poster_name) AS poster_name, m.poster_time,
t.num_replies, t.id_topic, m.id_member, m.smileys_enabled, m.id_msg, t.locked, t.id_board, b.name AS board_name, c.id_cat, c.name AS cat_name
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
INNER JOIN {db_prefix}boards AS b ON (t.id_board = b.id_board)
INNER JOIN {db_prefix}categories AS c ON (b.id_cat = c.id_cat)
WHERE t.id_first_msg IN ({array_int:post_list})
ORDER BY t.id_first_msg DESC
LIMIT ' . count($posts),
array(
'post_list' => $posts,
)
);
$return = array();
$posters = array();
$messages = array();
$last = 0;
while ($row = $smcFunc['db_fetch_assoc']($request))
{
// If we want to limit the length of the post.
if ($parameters['length'] > 0 && $smcFunc['strlen']($row['body']) > $parameters['length'])
{
$row['body'] = $smcFunc['substr']($row['body'], 0, $parameters['length']);

// The first space or line break. (<br />, etc.)
$cutoff = max(strrpos($row['body'], ' '), strrpos($row['body'], '<'));

if ($cutoff !== false)
$row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
$row['body'] .= '...';
}

$row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']);

// Check that this message icon is there...
if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']]))
$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? 'images_url' : 'default_images_url';

censorText($row['subject']);
censorText($row['body']);

$return['topics'][$row['id_topic']] = array(
'id' => $row['id_topic'],
'board' => array(
'id' => $row['id_board'],
'name' => $row['board_name'],
'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['board_name'] . '</a>',
),
'category' => array(
'id' => $row['id_cat'],
'name' => $row['cat_name'],
'href' => $scripturl . '#c' . $row['id_cat'],
'link' => '<a href="' . $scripturl . '#c' . $row['id_cat'] . '">' . $row['cat_name'] . '</a>',
),
'message_id' => $row['id_msg'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
'subject' => $row['subject'],
'time' => timeformat($row['poster_time']),
'timestamp' => forum_time(true, $row['poster_time']),
'body' => $row['body'],
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.0',
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $row['num_replies'] . ' ' . ($row['num_replies'] == 1 ? $txt['ssi_comment'] : $txt['ssi_comments']) . '</a>',
'replies' => $row['num_replies'],
'comment_href' => !empty($row['locked']) ? '' : $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . ';num_replies=' . $row['num_replies'],
'comment_link' => !empty($row['locked']) ? '' : '<a href="' . $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . ';num_replies=' . $row['num_replies'] . '">' . $txt['ssi_write_comment'] . '</a>',
'new_comment' => !empty($row['locked']) ? '' : '<a href="' . $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . '">' . $txt['ssi_write_comment'] . '</a>',
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => !empty($row['id_member']) ? $scripturl . '?action=profile;u=' . $row['id_member'] : '',
'link' => !empty($row['id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>' : $row['poster_name']
),
'locked' => !empty($row['locked']),
'is_last' => false,
);
$posters[$row['id_member']][] = $row['id_topic'];
$messages[] = $row['id_msg'];
$last = $row['id_topic'];
}

$smcFunc['db_free_result']($request);

// Get all the attachments, but only if we actually want them
if ($parameters['attachments'] != 'none' && !empty($modSettings['attachmentEnable']) && ($context['user']['is_admin'] || count(array_intersect($parameters['board'], boardsAllowedTo('view_attachments'))) > 0))
{
$request = $smcFunc['db_query']('', '
SELECT
a.id_attach, a.id_folder, a.id_msg, a.filename, IFNULL(a.size, 0) AS filesize, a.downloads, a.approved,
a.width, a.height, IFNULL(thumb.id_attach, 0) AS id_thumb, thumb.width AS thumb_width, thumb.height AS thumb_height, m.id_topic
FROM {db_prefix}attachments AS a
LEFT JOIN {db_prefix}attachments AS thumb ON (thumb.id_attach = a.id_thumb)
INNER JOIN {db_prefix}messages AS m ON (a.id_msg = m.id_msg)
WHERE a.id_msg IN ({array_int:message_list})
AND a.attachment_type = {int:attachment_type}' . (!$modSettings['postmod_active'] || allowedTo('approve_posts') ? '' : '
AND a.approved = {int:is_approved}'),
array(
'message_list' => $messages,
'attachment_type' => 0,
'is_approved' => 1,
)
);
$temp = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$temp[$row['id_attach']] = $row;
if (!isset($attachments[$row['id_msg']]))
$attachments[$row['id_msg']] = array();
}
$smcFunc['db_free_result']($request);

// This is better than sorting it with the query...
ksort($temp);

foreach ($temp as $attach_single)
{
$attachment = array(
'href' => $scripturl . '?action=dlattach;topic=' . $attach_single['id_topic'] . '.0;attach=' . $attach_single['id_attach'],
'filename' => htmlspecialchars($attach_single['filename']),
'filesize' => round($attach_single['filesize'] / 1024, 2) . ' ' . $txt['kilobyte'],
'width' => $attach_single['width'],
'height' => $attach_single['height'],
'imgsize' => $attach_single['width'] > 0 ? $attach_single['width'] . 'x' . $attach_single['height'] : '',
'downloads' => $txt['attach_viewed'] . ' ' . $attach_single['downloads'] . ' ' . $txt['attach_times'],
);
$attachment['thumbnail'] = $attach_single['id_thumb'] == 0 ? false : array(
'href' => $scripturl . '?action=dlattach;topic=' . $attach_single['id_topic'] . '.0;attach=' . $attach_single['id_thumb'] . ';image',
'width' => $attach_single['thumb_width'],
'height' => $attach_single['thumb_height'],
);
$return['topics'][$attach_single['id_topic']]['attachments'][] = $attachment;
}
}

// Get all the avatars, but only if we actually want them, then attach to the posts!
if ($parameters['avatar'] != 'none')
{
if ($modSettings['avatar_action_too_large'] == 'option_html_resize' || $modSettings['avatar_action_too_large'] == 'option_js_resize')
{
$avatar_width = !empty($modSettings['avatar_max_width_external']) ? ' width="' . $modSettings['avatar_max_width_external'] . '"' : '';
$avatar_height = !empty($modSettings['avatar_max_height_external']) ? ' height="' . $modSettings['avatar_max_height_external'] . '"' : '';
}
else
{
$avatar_width = '';
$avatar_height = '';
}

$poster_ids = loadMemberData(array_keys($posters));
foreach ($poster_ids as $member)
{
$topic = $posters[$member]; // to get back to $return
$profile = $user_profile[$member];
$avatar = array(
'image' => $profile['avatar'] == '' ? ($profile['id_attach'] > 0 ? '<img src="' . (empty($profile['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $profile['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $profile['filename']) . '" alt="" class="avatar" border="0" />' : '') : (stristr($profile['avatar'], 'http://') ? '<img src="' . $profile['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($profile['avatar']) . '" alt="" class="avatar" border="0" />'),
'href' => $profile['avatar'] == '' ? ($profile['id_attach'] > 0 ? (empty($profile['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $profile['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $profile['filename']) : '') : (stristr($profile['avatar'], 'http://') ? $profile['avatar'] : $modSettings['avatar_url'] . '/' . $profile['avatar']),
);

if ($avatar['href'] > '')
foreach ($topic as $tid)
$return['topics'][$tid]['poster']['avatar'] = $avatar;

}
}

if (empty($return))
return $return;

$return['topics'][$last]['is_last'] = true;

$return['feed'] = array();

if (in_array('rss', $parameters['feed']))
$return['feed']['RSS'] = array(
'href' => $scripturl . '?action=.xml;sa=news;type=rss;boards=' . implode(',', $parameters['board']),
'link' => '<a href="' . $scripturl . '?action=.xml;sa=news;type=rss;boards=' . implode(',', $parameters['board']) . '">RSS</a>',
);

if (in_array('rdf', $parameters['feed']))
$return['feed']['RDF'] = array(
'href' => $scripturl . '?action=.xml;sa=news;type=rdf;boards=' . implode(',', $parameters['board']),
'link' => '<a href="' . $scripturl . '?action=.xml;sa=news;type=rdf;boards=' . implode(',', $parameters['board']) . '">RDF</a>',
);

if (in_array('rdf', $parameters['feed']))
$return['feed']['Atom'] = array(
'href' => $scripturl . '?action=.xml;sa=news;type=atom;boards=' . implode(',', $parameters['board']),
'link' => '<a href="' . $scripturl . '?action=.xml;sa=news;type=atom;boards=' . implode(',', $parameters['board']) . '">Atom</a>',
);

if ($parameters['output_type'] != 'echo')
return $return;

foreach ($return['topics'] as $news)
{
if ($parameters['avatar'] != 'none' && isset($news['poster']['avatar']))
$news['body'] = '<img class="ssi_avatar" src="' . $news['poster']['avatar']['href'] . '" style="margin:0 1em 1em 1em; float: ' . $parameters['avatar'] . '" />' . $news['body'];

echo '
<div>
', ($parameters['category_disp'] ? '[' . $news['category']['link'] . ']' : ''), ($parameters['board_disp'] ? ' [' . $news['board']['link'] . ']' : ''), ' <a href="', $news['href'], '">', $news['icon'], '</a> <strong>', $news['subject'], '</strong>
<div class="smaller">', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], '</div>

<div class="post" style="padding: 2ex 0;">', $news['body'], '</div>

', ($parameters['perms_override'] ? '' : $news['link'] . ($news['locked'] ? '' : ' | ' . $news['comment_link'])), '
</div>';

if (!empty($news['attachments']))
{
$count = count($news['attachments']);
if ($count > 0) {
switch($parameters['attachments'])
{
case 'linkonly':
echo ' <ul>';
foreach ($news['attachments'] as $attach)
echo '
<li><a target="_blank" href="', $attach['href'], '">', $attach['filename'], '</a> (', ($attach['imgsize'] != '' ? $attach['imgsize'] . ', ' : ''), $attach['filesize'], ')</li>';
echo '
</ul>';
break;
case 'thumbnail':
foreach ($news['attachments'] as $attach)
{
echo '
<div class="ssi_attach" style="margin-top:0.3em;">';
if ($attach['thumbnail'])
echo '
<img src="', $attach['thumbnail']['href'], '" width="', $attach['thumbnail']['width'], '" height="', $attach['thumbnail']['height'], '" />';
echo '
<div class="ssi_attach_filename"><a target="_blank" href="', $attach['href'], '">', $attach['filename'], '</a></div>
<div class="ssi_attach_filesize">', $attach['filesize'], ($attach['imgsize'] != '' ? ', ' . $attach['imgsize'] : ''), '</div>';
echo '
</div>';
}
break;
case 'inline':
foreach ($news['attachments'] as $attach)
{
echo '
<div class="ssi_attach" style="margin-top:0.3em;">';
if ($attach['width'] > 0)
echo '
<img src="', $attach['href'], '" width="', $attach['width'], '" height="', $attach['height'], '" />';
echo '
<div class="ssi_attach_filename"><a target="_blank" href="', $attach['href'], '">', $attach['filename'], '</a></div>
<div class="ssi_attach_filesize">', ($attach['imgsize'] != '' ? $attach['imgsize'] . ', ' : ''), $attach['filesize'], '</div>
</div>';
}
break;
}
}
}

if (!$news['is_last'])
echo '
<hr style="margin: 2ex 0; clear:left;" width="100%" />';
}

// Now, what about feeds

if (count($return['feed']) > 0)
{
$feeds = array();
foreach ($return['feed'] as $feed)
$feeds[] = $feed['link'];
echo '
<hr style="margin: 2ex 0;" width="100%" />
<div class="smalltext">', implode(' | ', $feeds), '</div>';
}
}
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Arantor on March 13, 2013, 08:14:33 PM
-sigh- I want to see this stuff in action, ideally with a link to the threads in question that they're being pulled from.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Deadfire on March 13, 2013, 08:20:07 PM
Quote from: Arantor on March 13, 2013, 08:14:33 PM
-sigh- I want to see this stuff in action, ideally with a link to the threads in question that they're being pulled from.

Heh, it's a private in-dev forum at the moment, contact me via PM if you wish to see it, otherwise it's just a normally vanilla install other then the permissions changed up like I described.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Arantor on March 13, 2013, 08:31:57 PM
That's the reason I want to see for myself - but I'm not going to do the PM tag dance (nothing personal, I just don't like doing anything in private) - because in about 85% of the cases where "it's set up like I described..." it isn't.

Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Deadfire on March 13, 2013, 09:22:10 PM
Quote from: Arantor on March 13, 2013, 08:31:57 PM
That's the reason I want to see for myself - but I'm not going to do the PM tag dance (nothing personal, I just don't like doing anything in private) - because in about 85% of the cases where "it's set up like I described..." it isn't.

I can understand that mate, but as I said it's pre-dev and hidden away for that purpose. Is there another way other then myself making up a public mock up somewhere?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Deadfire on March 25, 2013, 09:48:55 PM
I think I have my issue with the code for display. I have the following:


$parameters = array(
'limit' => 5,
'board' => array(1,2,3,4,5),
'output_type' => 'array',
'attachments'=> ''thumbnail',
);
$return = ssi_multiBoardNews($parameters);
foreach ($return['topics'] as $news)
{
echo'
<article>
<h2>', $news['subject'], '</h2>
<p class="pubdate">written by ', $news['poster']['link'], ', <time datetime="2013-03-01T12:00:00-05:00">', $news['time'], '</time></p>
<p class="pubdate">posted in ', $news['board']['link'], '</p>
<hr />
<p>', $news['body'], '</p>';
if (isset($news['attachments']))               
                     echo '
            <p><img src="', $news['attachments']['href'], '"/></p>';         
echo' <hr />
<p class="read">', $news['link'], ' | ', $news['new_comment'], '</p>
</article>
<hr class="article-divider" />';

if (!$news['is_last'])
echo '
<hr>
<br />';
}


thinking that my syntax here is wrong
    echo ' <p><img src="', $news['attachments']['href'], '"/></p>'; 

As it sits I get a blank img src
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Suki on March 26, 2013, 06:33:36 PM
You always need to check for any var you would want to use before actually using it,  you don't know if the topic have any attachments or if the attachments are images.

Do a var_dump()  on $news['attachments'] to see what exactly does it contains:  var_dump($news['attachments']);
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Deadfire on April 03, 2013, 07:28:43 PM
Quote from: Suki on March 26, 2013, 06:33:36 PM
You always need to check for any var you would want to use before actually using it,  you don't know if the topic have any attachments or if the attachments are images.

Do a var_dump()  on $news['attachments'] to see what exactly does it contains:  var_dump($news['attachments']);

Aye, it is returning as NULL, which I guess is a issue with the function then?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Suki on April 03, 2013, 09:10:36 PM
Well, does the topics you want to fetch actually has any attachments?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Deadfire on April 03, 2013, 09:40:02 PM
Quote from: Suki on April 03, 2013, 09:10:36 PM
Well, does the topics you want to fetch actually has any attachments?

Yes it does
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Deadfire on April 04, 2013, 12:07:10 AM
Quote from: Deadfire on April 03, 2013, 09:40:02 PM
Quote from: Suki on April 03, 2013, 09:10:36 PM
Well, does the topics you want to fetch actually has any attachments?

Yes it does


I must make a edit here I may have missed it but var dumping did reveal the arrays


array(1) { [0]=> array(8) { ["href"]=> string(86) "http://*****/forum/index.php?action=dlattach;topic=12.0;attach=4" ["filename"]=> string(30) "*****.jpg" ["filesize"]=> string(9) "796.64 kB" ["width"]=> string(4) "2550" ["height"]=> string(4) "3299" ["imgsize"]=> string(9) "2550x3299" ["downloads"]=> string(14) "viewed 0 times" ["thumbnail"]=> array(3) { ["href"]=> string(92) "http://*****/labs/forum/index.php?action=dlattach;topic=12.0;attach=5;image" ["width"]=> string(3) "386" ["height"]=> string(3) "500" } } }


*****s of course added by myself.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Deadfire on April 07, 2013, 07:05:04 PM
doing a bump on this just wondering if there would be a answer
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Deadfire on April 07, 2013, 10:17:07 PM
This is fixed the issue was because there can be more then 1 attachment you need to make sure you need to make sure to set that.

so

<img src="', $news['attachments'][0]['thumbnail']['href'], '"/> will give you your result :)
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Suki on April 08, 2013, 08:17:46 PM
Well, I assumed  you already knew that the attachments var was actually an array containing all possible attachments for said post.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Deadfire on April 21, 2013, 12:51:52 AM
Well after the issue with attachments thats more my fault then anything I do have a question.

Is it possibly to add some sort of page break function, or hidden text function to the post that's displayed?

The issue I have is working with a Character limit of 500, the articles that are posted up are much longer and contain a lot of bbcode for formatting. The limit has a habit of cutting off during bbcode leading to things like "[font=arial..." and looking for a way to have the author to force a break.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Suki on April 21, 2013, 02:47:04 PM
Not easy, at least not without building a robust func, I got a func for truncating a string but it doesn't handle HTML or BBC so most of the times you end up with broken code.

There are several attempts floating around:
http://stackoverflow.com/questions/1193500/php-truncate-html-ignoring-tags
http://alanwhipple.com/2011/05/25/php-truncate-string-preserving-html-tags-words/
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Deadfire on May 11, 2013, 10:49:16 PM
I'm having a bit of a issue trying to show a single board, The code works just fine for more then 1 though....

I'm getting 'Invalid argument supplied for foreach()'

This is my code:

<?php
$parameters = array(
'limit' => 5,
'board' => 2,
'output_type' => 'array',
'length' => 500,
'attachments'=> 'thumbnail',
);
$return ssi_multiBoardNews($parameters);
foreach ($return['topics'] as $news)
{

echo'
<article>
<h2>'
$news['subject'], '</h2>
<p class="pubdate">written by '
$news['poster']['link'], ', <time datetime="2013-03-01T12:00:00-05:00">'$news['time'], '</time></p>
<p class="pubdate">posted in '
$news['board']['link'], '</p>
<hr />
<p>'
$news['body'], '</p>';
if (isset($news['attachments']))
                     echo 
'
            <br><p><a href="'
$news['attachments'][0]['href'], '"><img src="'$news['attachments'][0]['thumbnail']['href'], '"/></a></p>'
echo' <hr />
<p class="read">'
$news['link'], ' | '$news['new_comment'], '</p>
</article>
<hr class="article-divider" />'
;

if (!$news['is_last'])
echo '
<hr>
<br />'
;
}
echo'<div class="clear-fix"></div>';

echo '</div>';

echo '</div>';
?>



var_dump ($parameters); gives;

array(5) { ["limit"]=> int(5) ["board"]=> int(2) ["output_type"]=> string(5) "array" ["length"]=> int(500) ["attachments"]=> string(9) "thumbnail" }
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Arantor on May 11, 2013, 10:59:15 PM
What foreach()?

Also, how modified is your version of this?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Deadfire on May 11, 2013, 11:06:07 PM
Quote from: Arantor on May 11, 2013, 10:59:15 PM
What foreach()?

$return = ssi_multiBoardNews($parameters);
foreach ($return['topics'] as $news)


Quote from: Arantor on May 11, 2013, 10:59:15 PMAlso, how modified is your version of this?

The function should have no changes other then the fix for boardsAllowedTo() having strange properties for admins. link here (http://www.simplemachines.org/community/index.php?topic=355945.msg2979264#msg2979264)

but for a more clear reading here it is:

// Arantor: ssi_multiBoardNews
function ssi_multiBoardNews($parameters)
{
global $scripturl, $db_prefix, $txt, $settings, $modSettings, $context, $smcFunc, $user_profile;

loadLanguage('Stats');

// Load the message icons - the usual suspects.
$stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
$icon_sources = array();
foreach ($stable_icons as $icon)
$icon_sources[$icon] = 'images_url';

$feed_types = array('rss', 'rdf', 'atom', 'none');
$attach_types = array('none', 'linkonly', 'thumbnail', 'inline');
$avatar_types = array('none', 'left', 'right');

// Checking off the parameters first
$parameters['limit'] = isset($parameters['limit']) ? max(1, (int) $parameters['limit']) : 5;
$parameters['start'] = isset($parameters['start']) ? max(0, (int) $parameters['start']) : 0;
$parameters['length'] = isset($parameters['length']) ? (int) $parameters['length'] : 0;
$parameters['perms_override'] = isset($parameters['perms_override']) ? (bool) $parameters['perms_override'] : false;
$parameters['attachments'] = isset($parameters['attachments']) ? (in_array($parameters['attachments'], $attach_types) ? $parameters['attachments'] : 'none') : 'none';
$parameters['avatar'] = isset($parameters['avatar']) ? (in_array($parameters['avatar'], $avatar_types) ? $parameters['avatar'] : 'none') : 'none';

$parameters['feed'] = isset($parameters['feed']) ? (array) $parameters['feed'] : array('none');
$parameters['feed'] = array_intersect($parameters['feed'], $feed_types);
if (count($parameters['feed']) == 0)
$parameters['feed'] = array('none');

$parameters['board'] = isset($parameters['board']) ? (array) $parameters['board'] : array(0);
$parameters['category'] = isset($parameters['category']) ? (array) $parameters['category'] : array(0);
$parameters['board_disp'] = isset($parameters['board_disp']) ? (bool) $parameters['board_disp'] : true;
$parameters['category_disp'] = isset($parameters['category_disp']) ? (bool) $parameters['category_disp'] : false;

$parameters['icon'] = isset($parameters['icon']) ? (array) $parameters['icon'] : array();
$parameters['icon'] = array_intersect(array_unique($parameters['icon']), $stable_icons);

$parameters['output_type'] = isset($parameters['output_type']) ? ($parameters['output_type'] == 'echo' ? 'echo' : 'array') : 'echo';

foreach ($parameters['board'] as $key => $value)
{
$value = (int) $value;
if ($value < 1)
unset ($parameters['board'][$key]);
else
$parameters['board'][$key] = (int) $value;
}

if (!empty($parameters['category']))
{
$parameters['category'] = array_unique((array) $parameters['category']);
foreach ($parameters['category'] as $key => $value)
{
$value = (int) $value;
if ($value < 1)
unset ($parameters['category'][$key]);
else
$parameters['category'][$key] = (int) $value;
}

if (count($parameters['category']) > 0)
{
$query = $smcFunc['db_query']('', '
SELECT id_board FROM {db_prefix}boards WHERE id_cat IN ({array_int:cat_list})',
array(
'cat_list' => $parameters['category'],
)
);
while($row = $smcFunc['db_fetch_row']($query))
$parameters['board'][] = $row[0];

$smcFunc['db_free_result']($query);
}
}

$parameters['board'] = array_unique($parameters['board']);

if (count($parameters['board']) == 0)
$parameters['board'] = array(0);

if (!$parameters['perms_override'])
{
// So we're checking the guest perms here. Note this can only be done from a PHP call.
// You can't do this from an external SSI type include (via $_GET) for obvious reasons!

$board_count = count($parameters['board']);

$board_limit = 1;
$where = 'FIND_IN_SET(-1, member_groups)';
if ($board_count > 1)
{
$where = 'id_board IN ({array_int:board_list}) AND ' . $where;
$board_limit = $board_count;
}

// So, either get all boards we asked for and check their membergroups,
// or we asked for nothing, so get the first board you find that is guest safe

$request = $smcFunc['db_query']('', '
SELECT id_board
FROM {db_prefix}boards
WHERE ' . $where . '
LIMIT {int:limit}',
array(
'board_list' => $parameters['board'],
'limit' => $board_limit,
)
);
if ($smcFunc['db_num_rows']($request) == 0)
{
if ($output_method == 'echo')
die($txt['ssi_no_guests']);
else
return array();
}

$allowed_boards = array();
while($row = $smcFunc['db_fetch_row']($request))
$allowed_boards[] = $row[0];
$smcFunc['db_free_result']($request);

if ($board_count > 0)
$parameters['board'] = array_intersect($parameters['board'], $allowed_boards);
else
$parameters['board'] = $allowed_boards;

if (count($parameters['board']) == 0)
$parameters['board'] = array(0);
}

// Find the post ids.
$request = $smcFunc['db_query']('', '
SELECT id_first_msg, icon
FROM {db_prefix}topics AS t INNER JOIN {db_prefix}messages AS m ON (t.id_first_msg = m.id_msg)
WHERE t.id_board IN ({array_int:board_list})' . (count($parameters['icon']) > 0 ? '
AND m.icon IN ({array_string:icon})' : '') . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}' : '') . '
ORDER BY id_first_msg DESC
LIMIT ' . $parameters['start'] . ', ' . $parameters['limit'],
array(
'board_list' => $parameters['board'],
'is_approved' => 1,
'icon' => $parameters['icon'],
)
);

$posts = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$posts[] = $row['id_first_msg'];
$smcFunc['db_free_result']($request);

if (empty($posts))
return array();

// Find the posts.
$request = $smcFunc['db_query']('', '
SELECT
m.icon, m.subject, m.body, IFNULL(mem.real_name, m.poster_name) AS poster_name, m.poster_time,
t.num_replies, t.id_topic, m.id_member, m.smileys_enabled, m.id_msg, t.locked, t.id_board, b.name AS board_name, c.id_cat, c.name AS cat_name
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
INNER JOIN {db_prefix}boards AS b ON (t.id_board = b.id_board)
INNER JOIN {db_prefix}categories AS c ON (b.id_cat = c.id_cat)
WHERE t.id_first_msg IN ({array_int:post_list})
ORDER BY t.id_first_msg DESC
LIMIT ' . count($posts),
array(
'post_list' => $posts,
)
);
$return = array();
$posters = array();
$messages = array();
$last = 0;
while ($row = $smcFunc['db_fetch_assoc']($request))
{
// If we want to limit the length of the post.
if ($parameters['length'] > 0 && $smcFunc['strlen']($row['body']) > $parameters['length'])
{
$row['body'] = $smcFunc['substr']($row['body'], 0, $parameters['length']);

// The first space or line break. (<br />, etc.)
$cutoff = max(strrpos($row['body'], ' '), strrpos($row['body'], '<'));

if ($cutoff !== false)
$row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
$row['body'] .= '...';
}

$row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']);

// Check that this message icon is there...
if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']]))
$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? 'images_url' : 'default_images_url';

censorText($row['subject']);
censorText($row['body']);

$return['topics'][$row['id_topic']] = array(
'id' => $row['id_topic'],
'board' => array(
'id' => $row['id_board'],
'name' => $row['board_name'],
'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['board_name'] . '</a>',
),
'category' => array(
'id' => $row['id_cat'],
'name' => $row['cat_name'],
'href' => $scripturl . '#c' . $row['id_cat'],
'link' => '<a href="' . $scripturl . '#c' . $row['id_cat'] . '">' . $row['cat_name'] . '</a>',
),
'message_id' => $row['id_msg'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
'subject' => $row['subject'],
'time' => timeformat($row['poster_time']),
'timestamp' => forum_time(true, $row['poster_time']),
'body' => $row['body'],
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.0',
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $row['num_replies'] . ' ' . ($row['num_replies'] == 1 ? $txt['ssi_comment'] : $txt['ssi_comments']) . '</a>',
'replies' => $row['num_replies'],
'comment_href' => !empty($row['locked']) ? '' : $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . ';num_replies=' . $row['num_replies'],
'comment_link' => !empty($row['locked']) ? '' : '<a href="' . $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . ';num_replies=' . $row['num_replies'] . '">' . $txt['ssi_write_comment'] . '</a>',
'new_comment' => !empty($row['locked']) ? '' : '<a href="' . $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . '">' . $txt['ssi_write_comment'] . '</a>',
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => !empty($row['id_member']) ? $scripturl . '?action=profile;u=' . $row['id_member'] : '',
'link' => !empty($row['id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>' : $row['poster_name']
),
'locked' => !empty($row['locked']),
'is_last' => false,
);
$posters[$row['id_member']][] = $row['id_topic'];
$messages[] = $row['id_msg'];
$last = $row['id_topic'];
}

$smcFunc['db_free_result']($request);

// Get all the attachments, but only if we actually want them
if ($parameters['attachments'] != 'none' && !empty($modSettings['attachmentEnable']) && ($context['user']['is_admin'] || count(array_intersect($parameters['board'], boardsAllowedTo('view_attachments'))) > 0))
{
$request = $smcFunc['db_query']('', '
SELECT
a.id_attach, a.id_folder, a.id_msg, a.filename, IFNULL(a.size, 0) AS filesize, a.downloads, a.approved,
a.width, a.height, IFNULL(thumb.id_attach, 0) AS id_thumb, thumb.width AS thumb_width, thumb.height AS thumb_height, m.id_topic
FROM {db_prefix}attachments AS a
LEFT JOIN {db_prefix}attachments AS thumb ON (thumb.id_attach = a.id_thumb)
INNER JOIN {db_prefix}messages AS m ON (a.id_msg = m.id_msg)
WHERE a.id_msg IN ({array_int:message_list})
AND a.attachment_type = {int:attachment_type}' . (!$modSettings['postmod_active'] || allowedTo('approve_posts') ? '' : '
AND a.approved = {int:is_approved}'),
array(
'message_list' => $messages,
'attachment_type' => 0,
'is_approved' => 1,
)
);
$temp = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$temp[$row['id_attach']] = $row;
if (!isset($attachments[$row['id_msg']]))
$attachments[$row['id_msg']] = array();
}
$smcFunc['db_free_result']($request);

// This is better than sorting it with the query...
ksort($temp);

foreach ($temp as $attach_single)
{
$attachment = array(
'href' => $scripturl . '?action=dlattach;topic=' . $attach_single['id_topic'] . '.0;attach=' . $attach_single['id_attach'],
'filename' => htmlspecialchars($attach_single['filename']),
'filesize' => round($attach_single['filesize'] / 1024, 2) . ' ' . $txt['kilobyte'],
'width' => $attach_single['width'],
'height' => $attach_single['height'],
'imgsize' => $attach_single['width'] > 0 ? $attach_single['width'] . 'x' . $attach_single['height'] : '',
'downloads' => $txt['attach_viewed'] . ' ' . $attach_single['downloads'] . ' ' . $txt['attach_times'],
);
$attachment['thumbnail'] = $attach_single['id_thumb'] == 0 ? false : array(
'href' => $scripturl . '?action=dlattach;topic=' . $attach_single['id_topic'] . '.0;attach=' . $attach_single['id_thumb'] . ';image',
'width' => $attach_single['thumb_width'],
'height' => $attach_single['thumb_height'],
);
$return['topics'][$attach_single['id_topic']]['attachments'][] = $attachment;
}
}

// Get all the avatars, but only if we actually want them, then attach to the posts!
if ($parameters['avatar'] != 'none')
{
if ($modSettings['avatar_action_too_large'] == 'option_html_resize' || $modSettings['avatar_action_too_large'] == 'option_js_resize')
{
$avatar_width = !empty($modSettings['avatar_max_width_external']) ? ' width="' . $modSettings['avatar_max_width_external'] . '"' : '';
$avatar_height = !empty($modSettings['avatar_max_height_external']) ? ' height="' . $modSettings['avatar_max_height_external'] . '"' : '';
}
else
{
$avatar_width = '';
$avatar_height = '';
}

$poster_ids = loadMemberData(array_keys($posters));
foreach ($poster_ids as $member)
{
$topic = $posters[$member]; // to get back to $return
$profile = $user_profile[$member];
$avatar = array(
'image' => $profile['avatar'] == '' ? ($profile['id_attach'] > 0 ? '<img src="' . (empty($profile['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $profile['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $profile['filename']) . '" alt="" class="avatar" border="0" />' : '') : (stristr($profile['avatar'], 'http://') ? '<img src="' . $profile['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($profile['avatar']) . '" alt="" class="avatar" border="0" />'),
'href' => $profile['avatar'] == '' ? ($profile['id_attach'] > 0 ? (empty($profile['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $profile['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $profile['filename']) : '') : (stristr($profile['avatar'], 'http://') ? $profile['avatar'] : $modSettings['avatar_url'] . '/' . $profile['avatar']),
);

if ($avatar['href'] > '')
foreach ($topic as $tid)
$return['topics'][$tid]['poster']['avatar'] = $avatar;

}
}

if (empty($return))
return $return;

$return['topics'][$last]['is_last'] = true;

$return['feed'] = array();

if (in_array('rss', $parameters['feed']))
$return['feed']['RSS'] = array(
'href' => $scripturl . '?action=.xml;sa=news;type=rss;boards=' . implode(',', $parameters['board']),
'link' => '<a href="' . $scripturl . '?action=.xml;sa=news;type=rss;boards=' . implode(',', $parameters['board']) . '">RSS</a>',
);

if (in_array('rdf', $parameters['feed']))
$return['feed']['RDF'] = array(
'href' => $scripturl . '?action=.xml;sa=news;type=rdf;boards=' . implode(',', $parameters['board']),
'link' => '<a href="' . $scripturl . '?action=.xml;sa=news;type=rdf;boards=' . implode(',', $parameters['board']) . '">RDF</a>',
);

if (in_array('rdf', $parameters['feed']))
$return['feed']['Atom'] = array(
'href' => $scripturl . '?action=.xml;sa=news;type=atom;boards=' . implode(',', $parameters['board']),
'link' => '<a href="' . $scripturl . '?action=.xml;sa=news;type=atom;boards=' . implode(',', $parameters['board']) . '">Atom</a>',
);

if ($parameters['output_type'] != 'echo')
return $return;

foreach ($return['topics'] as $news)
{
if ($parameters['avatar'] != 'none' && isset($news['poster']['avatar']))
$news['body'] = '<img class="ssi_avatar" src="' . $news['poster']['avatar']['href'] . '" style="margin:0 1em 1em 1em; float: ' . $parameters['avatar'] . '" />' . $news['body'];

echo '
<div>
', ($parameters['category_disp'] ? '[' . $news['category']['link'] . ']' : ''), ($parameters['board_disp'] ? ' [' . $news['board']['link'] . ']' : ''), ' <a href="', $news['href'], '">', $news['icon'], '</a> <strong>', $news['subject'], '</strong>
<div class="smaller">', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], '</div>

<div class="post" style="padding: 2ex 0;">', $news['body'], '</div>

', ($parameters['perms_override'] ? '' : $news['link'] . ($news['locked'] ? '' : ' | ' . $news['comment_link'])), '
</div>';

if (!empty($news['attachments']))
{
$count = count($news['attachments']);
if ($count > 0) {
switch($parameters['attachments'])
{
case 'linkonly':
echo ' <ul>';
foreach ($news['attachments'] as $attach)
echo '
<li><a target="_blank" href="', $attach['href'], '">', $attach['filename'], '</a> (', ($attach['imgsize'] != '' ? $attach['imgsize'] . ', ' : ''), $attach['filesize'], ')</li>';
echo '
</ul>';
break;
case 'thumbnail':
foreach ($news['attachments'] as $attach)
{
echo '
<div class="ssi_attach" style="margin-top:0.3em;">';
if ($attach['thumbnail'])
echo '
<img src="', $attach['thumbnail']['href'], '" width="', $attach['thumbnail']['width'], '" height="', $attach['thumbnail']['height'], '" />';
echo '
<div class="ssi_attach_filename"><a target="_blank" href="', $attach['href'], '">', $attach['filename'], '</a></div>
<div class="ssi_attach_filesize">', $attach['filesize'], ($attach['imgsize'] != '' ? ', ' . $attach['imgsize'] : ''), '</div>';
echo '
</div>';
}
break;
case 'inline':
foreach ($news['attachments'] as $attach)
{
echo '
<div class="ssi_attach" style="margin-top:0.3em;">';
if ($attach['width'] > 0)
echo '
<img src="', $attach['href'], '" width="', $attach['width'], '" height="', $attach['height'], '" />';
echo '
<div class="ssi_attach_filename"><a target="_blank" href="', $attach['href'], '">', $attach['filename'], '</a></div>
<div class="ssi_attach_filesize">', ($attach['imgsize'] != '' ? $attach['imgsize'] . ', ' : ''), $attach['filesize'], '</div>
</div>';
}
break;
}
}
}

if (!$news['is_last'])
echo '
<hr style="margin: 2ex 0; clear:left;" width="100%" />';
}

// Now, what about feeds

if (count($return['feed']) > 0)
{
$feeds = array();
foreach ($return['feed'] as $feed)
$feeds[] = $feed['link'];
echo '
<hr style="margin: 2ex 0;" width="100%" />
<div class="smalltext">', implode(' | ', $feeds), '</div>';
}
}


Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Arantor on May 11, 2013, 11:40:56 PM
If the foreach is invalid, $return['topics'] isn't an array, which suggests there's something funny going on.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Deadfire on May 11, 2013, 11:46:20 PM
Quote from: Arantor on May 11, 2013, 11:40:56 PM
If the foreach is invalid, $return['topics'] isn't an array, which suggests there's something funny going on.

I agree, thats why I found it odd that it works for multiple boards, but not for a single one.

'board' => array(1,2,3,4,5),
works, but

'board' => array(2), or 'board' => 2,
does not
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Arantor on May 11, 2013, 11:46:39 PM
So, board 2 has some content in it, right?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Deadfire on May 11, 2013, 11:48:19 PM
Quote from: Arantor on May 11, 2013, 11:46:39 PM
So, board 2 has some content in it, right?

Indeed it does.(83 topics in total)
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Arantor on May 11, 2013, 11:52:34 PM
Then I see no reason for it to be failing. It's not like I left the limiter in it that was in the original ssi_boardNews that only took the last % of topics for a board.

But there's something definitely awry somewhere, but it's late and I can't see anything obviously wrong. If I remember and have time I'll look into it, but I wouldn't hold your breath. Revisiting my old mods is not my normal idea of fun.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Deadfire on May 11, 2013, 11:57:43 PM
Quote from: Arantor on May 11, 2013, 11:52:34 PM
Then I see no reason for it to be failing. It's not like I left the limiter in it that was in the original ssi_boardNews that only took the last % of topics for a board.

But there's something definitely awry somewhere, but it's late and I can't see anything obviously wrong. If I remember and have time I'll look into it, but I wouldn't hold your breath. Revisiting my old mods is not my normal idea of fun.

Aye, I'll see what I can figure out in the meantime.

I agree with being tired, and looking at something you did years ago, sounds like spending time with an ex that you wish you never met :)
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: mark7144 on July 17, 2013, 12:58:25 PM
Hello Runic,

Great mod. I have a question, does this support the 'Attachment Positioning' mod so that attachments can be positioned within the articles?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: NIAB on July 20, 2013, 03:30:31 AM
Hey guys,

Was wondering if there is any way to use this ssi in order for it to show the topTopics from the desired boards. Reason for that is that ssi_topTopics doesnt show avatars, and I am yet to figure out a solution for this.

Thanks
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Motorhed on August 02, 2013, 12:51:51 PM
Probably mentioned before, but the board link, after the category link, always goes to the same random thread on my site.

http://tangledwebbing.com - Click the board name links in the main news area and they all go to the same thread.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Oskar78Swe on January 14, 2014, 04:07:53 AM
Old topic but maybe someone has come to a solution to the problem that i quote below.
I also have the same problem, I am not able to choose a single board or categeory unless it is board 1. The rest of the boards (2,3,4,5 and so on) get's the foreach problem as Deadfire has/had.

Has someone come to a solution to this?

Quote from: Deadfire on May 11, 2013, 10:49:16 PM
I'm having a bit of a issue trying to show a single board, The code works just fine for more then 1 though....

I'm getting 'Invalid argument supplied for foreach()'

This is my code:

<?php
$parameters = array(
'limit' => 5,
'board' => 2,
'output_type' => 'array',
'length' => 500,
'attachments'=> 'thumbnail',
);
$return ssi_multiBoardNews($parameters);
foreach ($return['topics'] as $news)
{

echo'
<article>
<h2>'
$news['subject'], '</h2>
<p class="pubdate">written by '
$news['poster']['link'], ', <time datetime="2013-03-01T12:00:00-05:00">'$news['time'], '</time></p>
<p class="pubdate">posted in '
$news['board']['link'], '</p>
<hr />
<p>'
$news['body'], '</p>';
if (isset($news['attachments']))
                     echo 
'
            <br><p><a href="'
$news['attachments'][0]['href'], '"><img src="'$news['attachments'][0]['thumbnail']['href'], '"/></a></p>'
echo' <hr />
<p class="read">'
$news['link'], ' | '$news['new_comment'], '</p>
</article>
<hr class="article-divider" />'
;

if (!$news['is_last'])
echo '
<hr>
<br />'
;
}
echo'<div class="clear-fix"></div>';

echo '</div>';

echo '</div>';
?>



var_dump ($parameters); gives;

array(5) { ["limit"]=> int(5) ["board"]=> int(2) ["output_type"]=> string(5) "array" ["length"]=> int(500) ["attachments"]=> string(9) "thumbnail" }
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: cnywrestling on July 21, 2014, 11:37:34 AM
A little late to the game, but I just started using this mod. Can anyone give me a little direction on how to alter it to just return the sticky topics?  I tried adding "with t.is_sticky = 1" to the selections, but it just returns nothing then. Any guidance would be greatly appreciated.
Thanks.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: vbgamer45 on July 21, 2014, 12:06:48 PM
Does not look like it supports sticky topics it would need to be altered.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Arantor on July 21, 2014, 01:15:25 PM
Correct, it was never one of the original design criteria.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: cnywrestling on July 21, 2014, 01:21:53 PM
Thanks. So it's not as simple as just changing the sql statements in the function? I wasn't sure how sticky topics were selected.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Arantor on July 21, 2014, 01:23:06 PM
No, it's not.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: cnywrestling on July 21, 2014, 01:24:30 PM
Thanks anyway...
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: ittiphol on July 22, 2014, 05:49:06 AM
How to set length

Thank you
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Arantor on July 22, 2014, 05:50:50 AM
Length of what?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: ittiphol on July 22, 2014, 10:15:29 AM
Quote from: ‽ on July 22, 2014, 05:50:50 AM
Length of what?

insert

'length' => 500,

it's ok thank you  ;D
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: ntfrance on August 31, 2016, 07:14:56 AM
hellos, I would like to run the option attached files, but I do not manage to activate the

someone could help me!
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: ormuz on December 02, 2017, 11:42:58 AM
This this mod allow you to do this:

Show one topic, from a specific defined list of topics in a random fashion?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Arantor on December 02, 2017, 11:48:21 AM
No, this just outputs news from boards as most recent topics per board.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Goten22 on March 24, 2018, 11:43:04 AM
Is it possible to display the number of views? Like "echo $news['views'];" ?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: vbgamer45 on March 24, 2018, 01:32:35 PM
No out of the box would require edits
such as to this query

SELECT
m.icon, m.subject, m.body, IFNULL(mem.real_name, m.poster_name) AS poster_name, m.poster_time,
t.num_replies, t.id_topic, m.id_member, m.smileys_enabled, m.id_msg, t.locked, t.id_board, b.name AS board_name, c.id_cat, c.name AS cat_name
FROM {db_prefix}topics AS t
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Looking on March 22, 2019, 05:54:43 AM
I can confirm that this mod only works if you have 2 or more board IDs listed. In other words, it will not function if you only want posts pulled from one board.

A brief scan through the code I do not see anything jump out to cause this Is there an easy fix or do I have to begin hacking? ;)
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Arantor on March 22, 2019, 06:02:01 AM
Did you give it an array of 1 board?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Looking on March 22, 2019, 06:05:13 AM
Yes.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Matthias on October 26, 2020, 11:36:13 AM
Hello,

I have membergroup types free to join or leave. If users join to the group, they get displayed an additional board.
Configured at Administration Center » Boards » Modify Boards » Allowed Groups

When a user joins the group, they won't see the topics. Even an admin does not see the topics, they should see all.
If I use 'perms_override' => true, for testing the topics are shown correctly.

I use this code:

// New Group Topics
$parameters = array(
'limit' => 5,
'length' => 42,
'category' => array(15),
'perms_override' => true,    >>Just for testing
'output_type' => 'array',
);
echo '
<div class="cat_bar">
    <h3 class="catbg">', $txt['welcome_NewGroupTopics'], '</h3>
</div>
<div>
<div class="windowbg2 contentblock">
<p>', $txt['welcome_NewGroupTopics_Description'], '</p>';
$group_topics = ssi_multiBoardNews($parameters);
// If nothing to show
if (empty($group_topics['topics']))
echo'
<div class="startpage_article">
<div style="float:left;"></div><div style="padding-top:15px;">', $txt['welcome_NoGroupTopics'], '</div>
</div>';
else
{
// Loop through all items
foreach ($group_topics['topics'] as $news)
{
// Output the items
echo '
<div>
<div style="float:left;"></div><div><h3><a href="', $news['href'], '">', $news['subject'], '</a></h3></div>
<div>', $news['body'], '</div>
', $news['link'], $news['locked'] ? '' : ' | ' . $news['comment_link'], '
</div>';
if (!$news['is_last'])
echo '
<br />';
}
}
echo '
</div>
</div>';


Does somebody has any idea.
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: Matthias on February 11, 2022, 05:24:58 AM
@vbgamer45
Do you plan to update this for 2.1?
Title: Re: SSI Multiple Board News (ssi_multiBoardNews)
Post by: vbgamer45 on February 11, 2022, 02:29:23 PM
Probably. I have to see what I need to change.