Advertisement:

Author Topic: Simple SSI Question  (Read 4883 times)

Offline TheGamer

  • Sophist Member
  • *****
  • Posts: 1,040
  • Gender: Male
Simple SSI Question
« on: June 25, 2006, 04:02:57 PM »
<?php ssi_recentTopics(); ?>

How do I make that only apply to one board (e.g. only display recent topics from board 85.0)

Thanks!

Offline Elmacik

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,276
  • Gender: Male
  • = Human Draft =
    • IT Store
Re: Simple SSI Question
« Reply #1 on: June 25, 2006, 04:09:36 PM »
You can use it like that:
Code: [Select]
<?php ssi_recentTopics(&#39;5&#39;, array(&#39;1&#39;, &#39;2&#39;, &#39;3&#39;)); ?>

Say you have 4 boards.. With the code above, you have restricted the recent topics to board 4, because you excluded the first three ones.
Number 5 in the code means the number of recent topics will be displayed.

And also take a look at:
Basic SSI FAQ
Advanced SSI FAQ
Expert SSI FAQ
Home of Elmacik

Offline TheGamer

  • Sophist Member
  • *****
  • Posts: 1,040
  • Gender: Male
Re: Simple SSI Question
« Reply #2 on: June 25, 2006, 04:13:14 PM »
Thanks for the prompt reply, but I'm not sure I understand what you're saying.
So if I want it to display only recent topics from the board 85.0, what code do I need to use?

<?php ssi_recentTopics('85.0', array('1', '2', '3')); ?>


?

Offline Elmacik

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,276
  • Gender: Male
  • = Human Draft =
    • IT Store
Re: Simple SSI Question
« Reply #3 on: June 25, 2006, 04:20:42 PM »
Unfortunately, ssi_recentTopics does not let us specify the board to include. In contrast, it lets us to exclude the boards we dont want while displaying the recent topics.
So if you want to show recent topics only from board 85, I suggest you to use board news like this:
Code: [Select]
<?php ssi_boardNews(&#39;85&#39;); ?>This will display the recent topics in the board 85.

If you still want to use recentTopics; you can use it this way:
Code: [Select]
<?php ssi_recentTopics(&#39;1&#39;, &#39;2&#39;, &#39;3&#39;, &#39;4&#39;, &#39;5&#39;, &#39;6&#39;, &#39;7&#39;, &#39;8&#39;, &#39;9&#39;, &#39;10&#39;, &#39;11&#39;, &#39;12&#39;, &#39;13&#39;); ?>Those go till 85.. This means, recentTopics function will exclude the boards 1,2,3,4,5,6,7,8,9,10,11,12,13.. so on.
Home of Elmacik

Offline Thantos

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 16,163
  • Gender: Male
Re: Simple SSI Question
« Reply #4 on: June 25, 2006, 04:43:58 PM »
Well personally I'd wrap it up in a function.

Code: [Select]
function ssi_recentTopicsFromBoards($from_boards, $num_recent = 8, $output_method = 'echo')
{
global $context, $db_prefix, $user_info;
if ( !isset($context['boards_available']) )
{
// Get a list of the boards they can see
$context['boards_available'] = array();
$request = db_query("
SELECT ID_BOARD
FROM {$db_prefix}boards
WHERE $user_info[query_see_board]", __FILE__, __LINE__);
while ( $row = mysql_fetch_assoc($request) )
$context['boards_available'][] = (int) $row['ID_BOARD'];
mysql_free_result($request);
}

if ( !is_array($from_boards) )
$from_boards = array ( $from_boards );

// Make a copy of the board list so we can remove the ones we do want to see
$dontshow = $context['boards_available'];
foreach($dontshow AS $index => $id)
if ( in_array($id, $from_boards) )
unset($dontshow[$index]);
return ssi_recentTopics($num_recent, $dontshow, $output_method);
}

Note the above is not tested.

Offline duck1

  • Newbie
  • *
  • Posts: 4
    • Mystic Guild of Nordrassil
Re: Simple SSI Question
« Reply #5 on: December 05, 2006, 12:49:36 PM »
Well i can say this:
Put the code from thantos code into ssi.php and it works perfectly..
But how to remove the user check and just list newest from a forum with guest access ?
can it be modefied to this ?


« Last Edit: December 05, 2006, 01:06:39 PM by duck1 »

Offline Sessizlik Senfonisi

  • Full Member
  • ***
  • Posts: 417
  • Kafkas Üniversitesi Gençlik Portalı
Re: Simple SSI Question
« Reply #6 on: December 24, 2006, 06:26:34 PM »
i want to use it...

But i am using MK_PortaL

My Block Code:

Code: [Select]
<?php

$content
=implode(""file

("http://localhost/111/forum/SSI.php?ssi_function=recentTopics"));

?>

How do i add ssi_recentTopicsFromBoards

Code: [Select]
<?php

$content
=implode(""file

("http://localhost/111/forum/SSI.php?ssi_function=[recentTopicsFromBoards"));

?>

it s not working :(

« Last Edit: December 26, 2006, 07:06:26 AM by Sessizlik Senfonisi »
http://www.kafkasuniversitesi.com

SMF Versiyon : 1.1.1
Kullanılan Tema : Default