SimplePortal
Support => English Support => Topic started 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
-
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.
-
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.
-
You can use this:
global $context;
echo '
<ul>';
foreach ($context['news_lines'] as $news)
echo '
<li>', $news, '</li>';
echo '
</ul>';
-
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.
<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>
-
You can use this:
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>';
-
Ahh I get it now. See ya hit me over the head with a stick and it makes sense... :)
-
So this is what I ended up with
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>';
-
Is that working well for you?
-
Not a fader but pretty much the same thanks for all the help from everyone.