News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Simple SSI Question

Started by TheGamer, June 25, 2006, 04:02:57 PM

Previous topic - Next topic

TheGamer

<?php ssi_recentTopics(); ?>

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

Thanks!

Elmacik

You can use it like that:

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


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

TheGamer

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')); ?>


?

Elmacik

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:
<?php ssi_boardNews('85'); ?>
This will display the recent topics in the board 85.

If you still want to use recentTopics; you can use it this way:
<?php ssi_recentTopics('1''2''3''4''5''6''7''8''9''10''11''12''13'); ?>
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

Thantos

Well personally I'd wrap it up in a function.


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.

duck1

#5
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 ?



Sessizlik Senfonisi

#6
i want to use it...

But i am using MK_PortaL

My Block Code:

<?php

$content
=implode(""file

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

?>


How do i add ssi_recentTopicsFromBoards

<?php

$content
=implode(""file

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

?>


it s not working :(

http://www.kafkasuniversitesi.com

SMF Versiyon : 1.1.1
Kullanılan Tema : Default

Advertisement: