collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 247
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Installation errors? Mod incompatibilities? Upgrade problems? Make your way over to the Install and Upgrade Support board for all your solutions!

Author Topic: Make news block fade  (Read 25236 times)

0 Members and 1 Guest are viewing this topic.

Offline stikkki

  • Semi Newbie
  • *
  • Posts: 14
    • Eots Dzine
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Make news block fade
« on: March 26, 2009, 09:21:47 AM »
im building a forum for a charity organisation and i would like the news block to fade like the news fader on the forum rather than the news changing on page refresh

Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Make news block fade
« Reply #1 on: April 08, 2009, 03:46:56 AM »
Put the following code into a Custom PHP block:
Code: [Select]
global $context, $settings;

echo '
<div id="sp_news_fader_', $id, '" class="sp_center sp_fullwidth"><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": 0, "g": 0, "b": 0}, smfFadeTo = {"r": 255, "g": 255, "b": 255};
// Surround each item with... anything special?
var smfFadeBefore = "<b>", smfFadeAfter = "</b>";

var foreColor, backEl, backColor;

if (typeof(document.getElementById(\'sp_news_fader_', $id, '\').currentStyle) != "undefined")
{
foreColor = document.getElementById(\'sp_news_fader_', $id, '\').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(\'sp_news_fader_', $id, '\');
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(\'sp_news_fader_', $id, '\'), null).color.match(/rgb\((\d+), (\d+), (\d+)\)/);
smfFadeFrom = {"r": parseInt(foreColor[1]), "g": parseInt(foreColor[2]), "b": parseInt(foreColor[3])};

backEl = document.getElementById(\'sp_news_fader_', $id, '\');
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>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
smfFadeScroller = document.getElementById(\'sp_news_fader_', $id, '\');
// ]]></script>';
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Offline stikkki

  • Semi Newbie
  • *
  • Posts: 14
    • Eots Dzine
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: Make news block fade
« Reply #2 on: April 10, 2009, 09:26:58 AM »
this didnt work and actually didnt change the news even on refresh

Offline dougsbrat

  • Jr. Member
  • **
  • Posts: 55
  • Pull my finger!
Re: Make news block fade
« Reply #3 on: April 10, 2009, 10:25:18 AM »
I tried it and its great!  ;D thanks

be sure you have more than one news message for it to fade to, else one will be as shown with no fade.


I have another request for this...
is it possible for the block size to be fixed?
because:
when using the fade and the news items are not the same height (text lines or image) then the block size changes as each is shown, causing the lower blocks to move too  :'(


thanks for a good block

Offline stikkki

  • Semi Newbie
  • *
  • Posts: 14
    • Eots Dzine
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: Make news block fade
« Reply #4 on: April 10, 2009, 11:01:44 AM »
be sure you have more than one news message for it to fade to, else one will be as shown with no fade.

lol im not that think

i have 3 news items set up
i created a php block, added the above code and placed it in top block position but it only displays the first news item

http://www.somersetstaffies.org.uk/index.php

Offline dougsbrat

  • Jr. Member
  • **
  • Posts: 55
  • Pull my finger!
Re: Make news block fade
« Reply #5 on: April 10, 2009, 12:31:22 PM »
I gues I am   ;D cause I only had one news item and took a minute to figure it out.

BTW I use
SMF 1.1.8 and see you have 2.0
perhaps its that or a server setting?

Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Make news block fade
« Reply #6 on: April 11, 2009, 03:21:56 AM »
Use the code below for SMF 2 RC1:
Code: [Select]
   global $context, $settings;

   echo '
                        <div id="smfNewsFader"><div id="smfFadeScroller" class="sp_center sp_fullwidth"><span>', $context['news_lines'][0], '</span></div></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": 0, "g": 0, "b": 0}, smfFadeTo = {"r": 255, "g": 255, "b": 255};
// Surround each item with... anything special?
var smfFadeBefore = "<b>", smfFadeAfter = "</b>";

var foreColor, foreEl, 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")
{

foreEl = document.getElementById(\'smfFadeScroller\');

while (document.defaultView.getComputedStyle(foreEl, null).getPropertyCSSValue("color") == null && typeof(foreEl.parentNode) != "undefined" && typeof(foreEl.parentNode.tagName) != "undefined")
foreEl = foreEl.parentNode;

foreColor = document.defaultView.getComputedStyle(foreEl, null).getPropertyValue("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).getPropertyCSSValue("background-color") == null && typeof(backEl.parentNode) != "undefined" && typeof(backEl.parentNode.tagName) != "undefined")
backEl = backEl.parentNode;

backColor = document.defaultView.getComputedStyle(backEl, null).getPropertyValue("background-color");//.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'], '/scripts/fader.js"></script>';
« Last Edit: April 11, 2009, 03:26:14 AM by LHVWB »
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Offline stikkki

  • Semi Newbie
  • *
  • Posts: 14
    • Eots Dzine
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: Make news block fade
« Reply #7 on: April 11, 2009, 08:44:39 AM »
sorry i should of said it was 2.0

that worked fine LHVWB, thanx

Offline geekfairy

  • Semi Newbie
  • *
  • Posts: 19
  • SMF Version: 1.1.10
  • SP Version: 2.3.1
Re: Make news block fade
« Reply #8 on: May 03, 2009, 10:34:36 PM »
This works beautifully :)

Is there any way to not show titles/names of certain blocks?

I'm using this one to show some banners but would prefer it not to have to have a title sitting on the top of the block.

Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Make news block fade
« Reply #9 on: May 04, 2009, 12:33:08 AM »
Check the 'No Title' checkbox under the 'Style Options' area, when you edit a block.
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Offline geekfairy

  • Semi Newbie
  • *
  • Posts: 19
  • SMF Version: 1.1.10
  • SP Version: 2.3.1
Re: Make news block fade
« Reply #10 on: May 04, 2009, 12:38:41 AM »
 :-[ I thought I'd seen it there somewhere.

Not feeling well today...that's my only excuse  :P

Oh, and thankyou! :)


Offline geekfairy

  • Semi Newbie
  • *
  • Posts: 19
  • SMF Version: 1.1.10
  • SP Version: 2.3.1
Re: Make news block fade
« Reply #11 on: May 04, 2009, 04:31:34 AM »
Is there a way to fix the height of the news block? I am finding that in Firefox, the first time a page is loaded the news block jumps as it fades to nothing and the next banner fades in. I only have three banners on there right now and once it has cycled through once it is fine.

I had the same problem with the SMF news fader and that was solved by editing the template files to fix the height of the news box. What would I need to edit to do the same with this block?

Thanks :)

Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Make news block fade
« Reply #12 on: May 04, 2009, 05:09:32 AM »
Use the style options, you should be able to add 'height:20px;' to the style parameter for the body of the block.
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Offline geekfairy

  • Semi Newbie
  • *
  • Posts: 19
  • SMF Version: 1.1.10
  • SP Version: 2.3.1
Re: Make news block fade
« Reply #13 on: May 04, 2009, 05:25:10 AM »
Perfect  :D

Thanks so much. I'm really loving SP  :D

Offline Chit-Chat ChatterBox Boss

  • Semi Newbie
  • *
  • Posts: 9
  • SMF Version: 2 RC1
  • SP Version: 2.2
Re: Make news block fade
« Reply #14 on: May 15, 2009, 02:07:38 PM »
Sweet thanks!
« Last Edit: May 15, 2009, 03:25:23 PM by cafontaine »

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Make news block fade
« Reply #15 on: June 16, 2009, 12:06:53 AM »
Put the following code into a Custom PHP block:
Brilliant! Works like a charm.  Thanks!
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline primetime

  • Semi Newbie
  • *
  • Posts: 8
  • SMF Version: 2 RC1
  • SP Version: 2.2.2
Re: Make news block fade
« Reply #16 on: July 10, 2009, 05:37:00 PM »
Works great!!

Offline amlucent

  • Jr. Member
  • **
  • Posts: 65
  • Gender: Male
    • The Good Old Days [Old] Guild
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Make news block fade
« Reply #17 on: July 18, 2009, 03:25:59 AM »
When I use the code for SMF 2.0 it only fades on the board index..  I have my news block set to show up on "all pages"... can I make it fade everywhere?
« Last Edit: July 18, 2009, 01:16:21 PM by amlucent »

Offline Gurbet_42

  • Full Member
  • ***
  • Posts: 166
  • Gender: Male
    • Müziksiz ilahiler
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: Make news block fade
« Reply #18 on: January 05, 2010, 03:38:16 PM »
Not fades on 2.0 RC but fades on forum.
http://ilahivesohbet.com  -  Müziksiz ilahiler

Offline Nothingness

  • Jr. Member
  • **
  • Posts: 69
  • Gender: Male
  • I am...the architect of my own destruction...
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Make news block fade
« Reply #19 on: January 17, 2010, 05:06:44 AM »
I'm getting error "Syntax error in block code. Please check the code." when adding the code. I am on 2.0 RC2
SimplePortal 2.3.1
"Do you wallow in self-pity, or do you learn to use the gifts God gave you and command fear and respect, and defend against those who would do us harm"