Simple Portal

Support => English Support => Topic started by: FrostyWolf on May 24, 2011, 09:14:29 AM

Title: Filtering Board News?
Post by: FrostyWolf on May 24, 2011, 09:14:29 AM
My website is at frostywolf.com

Currently, in my Board News block, I am tracking the news in 3 diffrent boards, Minecraft News, Off-Topic News, and Terraria news.

Is there anyway to somehow filter each one with out giving it its own block?  As in if someone wanted to see just Minecraft News, they could click 'Minecraft', or Terraria News, click 'Terraria', etc?

I don't mind how it clumps them all together, but if I have visitors that only play minecraft, I wanted a easy way for them to sort just that news.

Thanks for any help.
Title: Re: Filtering Board News?
Post by: AngelinaBelle on May 24, 2011, 12:47:51 PM
One approach for that was detailed in Sinan's Blocks-in-Blocks post.http://simpleportal.net/index.php?topic=5332.0
This requires using some custom php and javascript coding, though.
Title: Re: Filtering Board News?
Post by: FrostyWolf on May 24, 2011, 01:41:49 PM
After a LOT of messing around, I managed:

$blocks = array(
array(
'label' => 'All News',
'type' => 'sp_boardnews',
'parameters' => array('board' => 3, 'limit' => 200, 'length' => 5000, 'per_page' => 5),
),
array(
'label' => 'Minecraft News',
'type' => 'sp_boardnews',
'parameters' => array('board' => 3, 'limit' => 200, 'length' => 5000, 'per_page' => 5),
),
array(
'label' => 'Terraria News',
'type' => 'sp_boardnews',
'parameters' => array('board' => 8, 'limit' => 200, 'length' => 5000, 'per_page' => 5),
),
array(
'label' => 'Off-Topic News',
'type' => 'sp_boardnews',
'parameters' => array('board' => 9, 'limit' => 200, 'length' => 5000, 'per_page' => 5),
),

);

global $txt;

$button_list = array();
foreach ($blocks as $id => $block)
{
$txt['sp_bib_label_' . $id] = $block['label'];

$button_list[] = array(
'text' => 'sp_bib_label_' . $id,
'image' => '',
'lang' => true,
'url' => '#sp_bib_' . $id . '" id="sp_bib_button_' . $id . '" onclick="sp_bib_change(' . $id . '); return false;',
);
}
$button_list[0]['active'] = true;
echo '
<div style="overflow: auto;">
', template_button_strip($button_list), '
</div>';
foreach ($blocks as $id => $block)
{
echo '
<div id="sp_bib_', $id, '"', $id != 0 ? ' style="display: none;"' : '', '>';
$block['type']($block['parameters'], 0);
echo '
</div>';
}
echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
function sp_bib_change(id)
{
for (var i = 0; i < ', count($blocks), '; i++)
{
document.getElementById(\'sp_bib_\' + i).style.display = i == id ? \'\' : \'none\';
document.getElementById(\'sp_bib_button_\' + i).className = \'button_strip_\' + i + (i == id ? \' active\' : \'\');
} }// ]]></script>';


And it seems to work ok except for two issues.

Issue one: I can not get the first block too display more then one board.  It is currently only displaying board 3:
'parameters' => array('board' => 3)

but I need it to display boars 3, 8 and 9, but I don't know what the line should look like to do that.

The correct code to do this is:
'board' => '9|3|8'

Issue two: If you go to frostywolf.com and look at the block, there appears to be no transparancy at all around the corners of the header things, making them all have ugly white corners.

If I could have help ironing out these last two things this last thing that would be great!
Title: Re: Filtering Board News?
Post by: AngelinaBelle on June 01, 2011, 07:24:28 AM
When I look, as guest, I do not see this problem. Please give me a theme number I can use.
http://frostywolf.com/index.php?theme=1
for example
Title: Re: Filtering Board News?
Post by: FrostyWolf on June 06, 2011, 02:18:29 PM
Quote from: AngelinaBelle on June 01, 2011, 07:24:28 AM
When I look, as guest, I do not see this problem. Please give me a theme number I can use.
http://frostywolf.com/index.php?theme=1
for example

Theme 1 is it, the issue is only in the news block.

Heres some arrows pointing at what I am refering to.
http://s7.photobucket.com/albums/y260/Frostywolf1/whitecorners.png

It does it in IE9 and Chrome.
Title: Re: Filtering Board News?
Post by: slop_chute on June 06, 2011, 03:52:47 PM

The all the images for the default theme have the white corners for a white background. You might want to go to the block settings for the News Server block and play with some of the option to change the class (other than windowbg)  or create a custom CSS for the block.  Anything beyond white is going to clash. This would be the simpliest way..
Title: Re: Filtering Board News?
Post by: AngelinaBelle on June 07, 2011, 06:23:19 AM
You are correct, slop_chute. I think the simplest thing would be to edit the block "Server News". Select "no body". You might even select "no head"
Title: Re: Filtering Board News?
Post by: FrostyWolf on June 07, 2011, 07:42:21 AM
Quote from: AngelinaBelle on June 07, 2011, 06:23:19 AM
You are correct, slop_chute. I think the simplest thing would be to edit the block "Server News". Select "no body". You might even select "no head"

Once again, great advice!  No body/title did the trick.
Title: Re: Filtering Board News?
Post by: Tricky on September 17, 2011, 03:47:11 PM
This is a fantastic code thanks ever so much
EhPortal 1.39.8 © 2024, WebDev