Page 1 of 2

Fading last messages on header

Posted: 13 May 2010, 17:15
by Oliver
http://www.boardtalk.net/forum/viewtopic.php?f=7&t=67

Open forum/include/functions.php

Find:

Code: Select all

// The following assigns all _common_ variables that may be used at any point in a template
Add before:

Code: Select all

    // Recent Posts

      $query1= $db->sql_query("SELECT posts.post_id, posts.topic_id, posts.poster_id, posts.post_time, posts.post_subject, users.username, users.user_avatar_type
               FROM posts LEFT JOIN users ON posts.poster_id = users.user_id
               ORDER BY posts.post_id DESC LIMIT 10");

      $n=0;
        while ($row1 = $db->sql_fetchrow($query1))
      {

      $gon_id      =   $row1['poster_id'];
      $gon      =   $row1['username'];
      $konu_id    =   $row1['topic_id'];
      $mesaj_id   =   $row1['post_id'];
      $header   =   $row1['post_subject']."</a>";
      $date      =   date("d F G:i", $row1['post_time']);


      $template->assign_block_vars('mesajlar', array(
       'N'       => $n,
       'GON'      => $gon,
       'GON_ID'      => $gon_id,
       'KONU_ID'     => $konu_id,
       'MESAJ_ID'   => $mesaj_id,
       'HEADER'      => $header,
       'DATE'       => $date,
        ));
      $n=$n+1;
      }
       $db->sql_freeresult($query1);
Open forum/styles/your_template/template/overall_header.html

Find:

Code: Select all

<a name="start_here"></a>
Add before:

Code: Select all

      <script type="text/javascript">

      /***********************************************
      * fading last messages
      * relased by sifirforum.com
      ***********************************************/

      var delay = 3000; //set delay between message change (in miliseconds)
      var maxsteps=40; // number of steps to take to change from start color to endcolor
      var stepdelay=60; // time in miliseconds of a single step
      //**Note: maxsteps*stepdelay will be total time in miliseconds of fading effect
      var startcolor= new Array(255,255,255); // start color (red, green, blue)
      var endcolor=new Array(0,0,0); // end color (red, green, blue)

      var fcontent=new Array();
      begintag='<div style="font: normal 12px Arial; padding: 5px; text-align:center;">'; //set opening tag, such as font declarations

      <!-- BEGIN mesajlar -->
      fcontent[{mesajlar.N}]="<a href=\"/forum/memberlist.php?mode=viewprofile&u={mesajlar.GON_ID}\" > <b>{mesajlar.GON}, </a> <a    href=\"/forum/viewtopic.php?t={mesajlar.KONU_ID}&p={mesajlar.MESAJ_ID}#p{mesajlar.MESAJ_ID}\"> {mesajlar.HEADER} </b></a>. ({mesajlar.DATE}, Last {mesajlar.N}. Message) ";
      <!-- END mesajlar -->   

      closetag='</div>';

      var fwidth='80px'; //set scroller width
      var fheight='30px'; //set scroller height

      var fadelinks=1;  //should links inside scroller content also fade like text? 0 for no, 1 for yes.

      ///No need to edit below this line/////////////////

      var ie4=document.all&&!document.getElementById;
      var DOM2=document.getElementById;
      var faderdelay=0;
      var index=0;


      /*Rafael Raposo edited function*/
      //function to change content
      function changecontent(){
      if (index>=fcontent.length)
        index=0
      if (DOM2){
        document.getElementById("fscroller").style.color="rgb("+startcolor[0]+", "+startcolor[1]+", "+startcolor[2]+")"
        document.getElementById("fscroller").innerHTML=begintag+fcontent[index]+closetag
        if (fadelinks)
          linkcolorchange(1);
        colorfade(1, 15);
      }
      else if (ie4)
        document.all.fscroller.innerHTML=begintag+fcontent[index]+closetag;
      index++
      }

      // colorfade() partially by Marcio Galli for Netscape Communications.  ////////////
      // Modified by Dynamicdrive.com

      function linkcolorchange(step){
      var obj=document.getElementById("fscroller").getElementsByTagName("A");
      if (obj.length>0){
        for (i=0;i<obj.length;i++)
          obj[i].style.color=getstepcolor(step);
      }
      }

      /*Rafael Raposo edited function*/
      var fadecounter;
      function colorfade(step) {
      if(step<=maxsteps) {   
        document.getElementById("fscroller").style.color=getstepcolor(step);
        if (fadelinks)
          linkcolorchange(step);
        step++;
        fadecounter=setTimeout("colorfade("+step+")",stepdelay);
      }else{
        clearTimeout(fadecounter);
        document.getElementById("fscroller").style.color="rgb("+endcolor[0]+", "+endcolor[1]+", "+endcolor[2]+")";
        setTimeout("changecontent()", delay);
       
      }   
      }

      function getstepcolor(step) {
      var diff
      var newcolor=new Array(3);
      for(var i=0;i<3;i++) {
        diff = (startcolor[i]-endcolor[i]);
        if(diff > 0) {
          newcolor[i] = startcolor[i]-(Math.round((diff/maxsteps))*step);
        } else {
          newcolor[i] = startcolor[i]+(Math.round((Math.abs(diff)/maxsteps))*step);
        }
      }
      return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")");
      }

      if (ie4||DOM2)
      document.write('<div id="fscroller" style="border:1px solid black;width:'+fwidth+';height:'+fheight+'"></div>');

      if (window.addEventListener)
      window.addEventListener("load", changecontent, false)
      else if (window.attachEvent)
      window.attachEvent("onload", changecontent)
      else if (document.getElementById)
      window.onload=changecontent

      </script>


Is that Prosilver or Subsilver2 installation?
How do I change the code so that it displays only their regions, the messages that I want to show?

Re: Fading last messages on header

Posted: 13 May 2010, 17:22
by cisco007
did he give you permission to post it here? boardtalk.net is a member here! if so I will let him answer you when they come by!

Re: Fading last messages on header

Posted: 13 May 2010, 17:25
by Oliver
There is link in his site ;)

Re: Fading last messages on header

Posted: 13 May 2010, 17:52
by cisco007
yeah, but if you put a link to his site, you shouldn't have posted the edits for that mod, unless you had permission!

Re: Fading last messages on header

Posted: 14 May 2010, 10:50
by boardtalk.net
That mod is by BlacksunTR and is a mod in development. I only changed it very, very slightly for my database. This is the topic: http://www.phpbb.com/community/viewtopi ... &t=2087645

Boardtalk.net is mostly a place where i keep notes on mods i'm using, where i've found them etc. Humm, I must go through the topics to make sure this is made clearer. I hope I haven't done anything wrong by doing that.

Thanks guys,
Boardtalk.net

Re: Fading last messages on header

Posted: 15 May 2010, 23:34
by boardtalk.net
Oliver wrote:Is that Prosilver or Subsilver2 installation?
How do I change the code so that it displays only their regions, the messages that I want to show?
First, can you change in the first post;
Open forum/styles/your_template/template/overall_header.html
Find:

Code: Select all

      var fwidth='80px'; //set scroller width
      var fheight='30px'; //set scroller height
Replace the '80px' with

Code: Select all

'100%'

Its Prosilver

If you wish to select only specific forums from your board to display;

1. Find out the required forum id number or numbers you wish to display.
For example on this forum we will use,
Stokers Site Announcement is 14 - posts.forum_id=14
and Missing Stuff is 15 - posts.forum_id=15
On the forum index, place your mouse over the forum and in Firefox it will be displayed on the bottom left of the browser.


2. Open forum/include/functions.php
Find:

Code: Select all

      $query1= $db->sql_query("SELECT posts.post_id, posts.topic_id, posts.poster_id, posts.post_time, posts.post_subject, users.username, users.user_avatar_type
               FROM posts LEFT JOIN users ON posts.poster_id = users.user_id
               ORDER BY posts.post_id DESC LIMIT 10");
Replace with:

Code: Select all

     $query1= $db->sql_query("SELECT posts.post_id, posts.topic_id, posts.poster_id, posts.post_time, posts.post_subject,  users.username, users.user_colour
                       FROM posts LEFT JOIN users ON posts.poster_id = users.user_id
                       WHERE posts.forum_id=14 or posts.forum_id=15
                       ORDER BY posts.post_id DESC LIMIT 10");
Save, ftp back, Purge the cache

********************

To change the quantity of recent messages showing:

2. Open forum/include/functions.php
Find:

Code: Select all

ORDER BY posts.post_id DESC LIMIT 10");
Change 10 to what ever number of posts you want to display.

Save, ftp back, Purge the cache

******************

To change the Size and with:

Open forum/styles/your_template/template/overall_header.html
Find:

Code: Select all

      var fwidth='100%'; //set scroller width
      var fheight='30px'; //set scroller height
Change the 100 and 30 to what ever works for you.

Save, ftp back, Purge the cache and refresh your styles template

********************

Hope I've answered your questions
;)

Re: Fading last messages on header

Posted: 15 May 2010, 23:39
by neptune
demo?

Re: Fading last messages on header

Posted: 15 May 2010, 23:43
by boardtalk.net

Re: Fading last messages on header

Posted: 16 May 2010, 11:07
by Oliver
Thank you.

I have the Forum, two areas which I do not want to display all messages, advice?


You put it in that example, showing how the desired area, how to change the code so I get out of the two areas that, but that all the other shows?

Code: Select all

     $query1= $db->sql_query("SELECT posts.post_id, posts.topic_id, posts.poster_id, posts.post_time, posts.post_subject,  users.username, users.user_colour
                       FROM posts LEFT JOIN users ON posts.poster_id = users.user_id
                       WHERE posts.forum_id=14 or posts.forum_id=15
                       ORDER BY posts.post_id DESC LIMIT 10");

Re: Fading last messages on header

Posted: 16 May 2010, 11:58
by Oliver
I would like to take only two regions out of sight, how will it succeed?