TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 195,994
  • Total Topics: 21,325
  • Online today: 142
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 93
  • Total: 93

News fader in top panel block, Blueskies theme help.

Started by GhostRider2110, March 03, 2009, 07:33:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

GhostRider2110

SMF 1.1.8
TP 1.0 B3
Modified Blue Skies theme
URL http://usscalemasters.org/forums/

I place the code found here:
http://www.tinyportal.net/index.php/topic,19906.0.html

In a PHP Code block in Top Panel but can't seem to get things to display. Since this was written to work in a different theme, are there changes I need to make for BlueSkies?

I have tried different combos of settings, with frame/title, without frame/title.  Since I can see the title if turned on, I know the block itself is working..

Thanks

--Mitch
Mitchell Baker

ZarPrime

Mitch,

First of all make sure you have at least 1 News Item in ...
Admin --> Main --> News and Newsletters

If you do, post the code you're using here

Inside code tags

and someone will take a look at it.

ZarPrime

GhostRider2110

Thanks ZarP, I have 3 news items..  Was not going to repeat the code since it is already in the link I posted and it is just verbatim in mine.. If I need to I will though... --Mitch
Mitchell Baker

ZarPrime

Post it.  That way I can put your exact code in my test site and see if it works.

ZP

IchBin

Do you have the news turned on in the theme settings?

GhostRider2110

Ok.... posting... hehehe



global $context, $settings, $options, $txt, $scripturl, $modSettings;

// Show the news fader?  (assuming there are things to show...)
if ($settings['show_newsfader'] && !empty($context['fader_news_lines']))
{
echo '
<div style="height: 50px; background: url('.$settings['images_url'].'/machine.jpg) repeat-x;">';

// Prepare all the javascript settings.
echo '
<div id="smfFadeScroller" style="text-align: center; width: 90%; padding: 2px;"><b>', $context['news_lines'][0], '</b></div>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
// The fading delay (in ms.)
var smfFadeDelay = ', empty($settings['newsfader_time']) ? 5000 : $settings['newsfader_time'], ';
// Fade from... what text color? To which background color?
var smfFadeFrom = {"r": 155, "g": 185, "b": 255}, smfFadeTo = {"r": 0, "g": 0, "b": 0};
// Surround each item with... anything special?
var smfFadeBefore = "<b>", smfFadeAfter = "</b>";

var foreColor, backEl, backColor;

if (typeof(document.getElementById(\'smfFadeScroller\').currentStyle) != "undefined")
{
foreColor = document.getElementById(\'smfFadeScroller\').currentStyle.color.match(/#([\da-f][\da-f])([\da-f][\da-f])([\da-f][\da-f])/);
smfFadeFrom = {"r": parseInt(foreColor[1]), "g": parseInt(foreColor[2]), "b": parseInt(foreColor[3])};

backEl = document.getElementById(\'smfFadeScroller\');
while (backEl.currentStyle.backgroundColor == "transparent" && typeof(backEl.parentNode) != "undefined")
backEl = backEl.parentNode;

backColor = backEl.currentStyle.backgroundColor.match(/#([\da-f][\da-f])([\da-f][\da-f])([\da-f][\da-f])/);
smfFadeTo = {"r": eval("0x" + backColor[1]), "g": eval("0x" + backColor[2]), "b": eval("0x" + backColor[3])};
}
else if (typeof(window.opera) == "undefined" && typeof(document.defaultView) != "undefined")
{
foreColor = document.defaultView.getComputedStyle(document.getElementById(\'smfFadeScroller\'), null).color.match(/rgb\((\d+), (\d+), (\d+)\)/);
smfFadeFrom = {"r": parseInt(foreColor[1]), "g": parseInt(foreColor[2]), "b": parseInt(foreColor[3])};

backEl = document.getElementById(\'smfFadeScroller\');
while (document.defaultView.getComputedStyle(backEl, null).backgroundColor == "transparent" && typeof(backEl.parentNode) != "undefined" && typeof(backEl.parentNode.tagName) != "undefined")
backEl = backEl.parentNode;

backColor = document.defaultView.getComputedStyle(backEl, null).backgroundColor.match(/rgb\((\d+), (\d+), (\d+)\)/);
smfFadeTo = {"r": parseInt(backColor[1]), "g": parseInt(backColor[2]), "b": parseInt(backColor[3])};
}

// List all the lines of the news for display.
var smfFadeContent = new Array(
"', implode('",
"', $context['fader_news_lines']), '"
);
// ]]></script><script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/fader.js"></script></div>';
}



Thanks....
Mitchell Baker

GhostRider2110

Quote from: IchBinâ„¢ on March 03, 2009, 07:49:15 PM
Do you have the news turned on in the theme settings?

Ok, I see what you are talking about, yes news is enabled, but I don't have checked "Show news fader on board index"

--Mitch
Mitchell Baker

ZarPrime

#7
"Enable News" does not need to be checked but "Show news fader on board index" does need to be checked.  This is in current theme.

Your code is exactly the same as what I use on my site except the height of the div and the fade delay.

Other than that, there is no reason that this shouldn't be working.

ZarPrime

ZarPrime

One of your News Items (the second one I think) causes a scrollbar to appear.  You can fix this by increasing the div height slightly.  5000 may be a little slow for the fade delay.  I'd consider trying 4000 just to see what you think.

I'm moving this to support.

ZarPrime

GhostRider2110

Yep that did it.. So I guess there is no way to have it now show up in the borad forum then.  Also fixed the height, thanks...

--Mitch
Mitchell Baker

This website is proudly hosted on Crocweb Cloud Website Hosting.