SimplePortal

Support => English Support => Topic started by: Mosser on March 14, 2011, 03:49:01 PM

Title: Forum News
Post by: Mosser on March 14, 2011, 03:49:01 PM
Is there a way for the Forum News Block to automatically cycle through all the news items? Not the Board News Block the Forum News Block.

SMF 2.0 RC4
SP 2.3.3

Thanks
Title: Re: Forum News
Post by: AngelinaBelle on March 15, 2011, 08:12:35 AM
That block displays a random news item. It does not have a way to cycle through them all.


The easiest way to achieve that effect would be to copy the "news fader" code from your theme into a custom php block.
It uses javascript and runs many times per second for as long as the page is open.
It can cause memory problems in some browsers -- IE for one.
Title: Re: Forum News
Post by: Mosser on March 15, 2011, 10:47:51 AM
I tried that but it just shows up blank. Not sure what I was doing wrong there.  I am going to play with it some more today.
Title: Re: Forum News
Post by: grafitus on March 15, 2011, 03:57:50 PM
You can use this:
Code: [Select]
global $context;

echo '
<ul>';
foreach ($context['news_lines'] as $news)
echo '
<li>', $news, '</li>';
echo '
</ul>';
Title: Re: Forum News
Post by: Mosser on March 15, 2011, 07:24:27 PM
Thanks but wouldn't that just show a list of all the news items?

I got the other to work in a PHP block but it looked exactly like the SMF one which is ugly in my opinion and this one is much nicer.  I did an HTML block like this which I can live with for now until I figure it out.

Code: [Select]
<marquee behavior=scroll height=100 scrollamount=2 direction="up" loop="true"><center>

<font color=#003366 size=4><strong>
Text1
</strong></font>

<br><br><br><br><br>

<font color=#003300 size=5><strong>
Text2
</strong></font>

</center></marquee>
Title: Re: Forum News
Post by: AngelinaBelle on March 17, 2011, 11:43:01 AM
You can use this:
Code: [Select]
global $context;

echo '
<marquee behavior=scroll height=100 scrollamount=2 direction="up" loop="true"><
<ul>';
foreach ($context['news_lines'] as $news)
   echo '
   <li>', $news, '</li>';
echo '
</ul>
</marquee>';
Title: Re: Forum News
Post by: Mosser on March 17, 2011, 02:40:47 PM
Ahh I get it now.  See ya hit me over the head with a stick and it makes sense...  :)
Title: Re: Forum News
Post by: Mosser on March 17, 2011, 04:36:47 PM
So this is what I ended up with

Code: [Select]
global $context;

if (count($context['news_lines'])>2)

foreach ($context['news_lines'] as $news)

echo '
<ul class=reset>
<center><li>', $news, '</li></center>
</ul>';

else

echo'   
<marquee onmouseover=this.stop() onmouseout=this.start()
behavior=scroll height=50 scrollamount=2 direction=up loop=true>
<ul class=reset>';

foreach ($context['news_lines'] as $news)   

echo '   
<center><li class=newspad>', $news, '<br><br><br><br></li></center>';

echo '
</ul>
</marquee>';
Title: Re: Forum News
Post by: AngelinaBelle on March 17, 2011, 04:49:23 PM
Is that working well for you?
Title: Re: Forum News
Post by: Mosser on March 17, 2011, 04:59:25 PM
Not a fader but pretty much the same thanks for all the help from everyone.
SimplePortal 2.3.8 © 2008-2024, SimplePortal