Fading last messages on header
Posted: 13 May 2010, 17:15
http://www.boardtalk.net/forum/viewtopic.php?f=7&t=67
Open forum/include/functions.php
Find:
Add before:
Open forum/styles/your_template/template/overall_header.html
Find:
Add before:
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?
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
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);
Find:
Code: Select all
<a name="start_here"></a>
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?