What i mean is that when you submit the news to view publicly then ticker would be updated with the news...
You would have to first have a js file like this:
//Translucent scroller- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use
var scroller_width='100%'
var scroller_height='30'
var bgcolor='#002D4D'
var pause=5000 //SET PAUSE BETWEEN SLIDE (3000=3 seconds)
var scrollercontent=new Array()
//Define scroller contents. Extend or contract array as needed
//mcd1
scrollercontent[0]='<div align="center" valign="middle" width="100%" height="100%">Microsoft Finds a worm in the basement! - <a class="news_scroller" href="index.php?shownews=yes&articleid=1">Read More!</a></div>'
scrollercontent[1]='<div align="center" valign="middle" width="100%" height="100%">Netwrk Opens Doors! - <a class="news_scroller" href="index.php?shownews=yes&articleid=2">Read More</a></div>'
scrollercontent[2]='<div align="center" valign="middle" width="100%" height="100%">GZ\'s New Bouncers Arive! - <a class="news_scroller" href="index.php?shownews=yes&articleid=3">Read More</a></div>'
//mcd1
////NO need to edit beyond here/////////////
var ie4=document.all
var dom=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1
if (ie4||dom)
document.write('<div style="position:relative;width:'+scroller_width+';height:'+scroller_height+';overflow:hidden"><div id="canvas0" style="position:absolute;background-color:'+bgcolor+';width:'+scroller_width+';height:'+scroller_height+';top:'+scroller_height+';filter:alpha(opacity=20);-moz-opacity:0.2;"></div><div id="canvas1" style="position:absolute;background-color:'+bgcolor+';width:'+scroller_width+';height:'+scroller_height+';top:'+scroller_height+';filter:alpha(opacity=20);-moz-opacity:0.2;"></div></div>')
else if (document.layers){
document.write('<ilayer id=tickernsmain visibility=hide width='+scroller_width+' height='+scroller_height+' bgColor='+bgcolor+'><layer id=tickernssub width='+scroller_width+' height='+scroller_height+' left=0 top=0>'+scrollercontent[0]+'</layer></ilayer>')
}
var curpos=scroller_height*(1)
var degree=10
var curcanvas="canvas0"
var curindex=0
var nextindex=1
function moveslide(){
if (curpos>0){
curpos=Math.max(curpos-degree,0)
tempobj.style.top=curpos+"px"
}
else{
clearInterval(dropslide)
if (crossobj.filters)
crossobj.filters.alpha.opacity=100
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=1
nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
tempobj.innerHTML=scrollercontent[curindex]
nextindex=(nextindex<scrollercontent.length-1)? nextindex+1 : 0
setTimeout("rotateslide()",pause)
}
}
function rotateslide(){
if (ie4||dom){
resetit(curcanvas)
crossobj=tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.style.zIndex++
if (crossobj.filters)
document.all.canvas0.filters.alpha.opacity=document.all.canvas1.filters.alpha.opacity=20
else if (crossobj.style.MozOpacity)
document.getElementById("canvas0").style.MozOpacity=document.getElementById("canvas1").style.MozOpacity=0.2
var temp='setInterval("moveslide()",50)'
dropslide=eval(temp)
curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
}
else if (document.layers){
crossobj.document.write(scrollercontent[curindex])
crossobj.document.close()
}
curindex=(curindex<scrollercontent.length-1)? curindex+1 : 0
}
function resetit(what){
curpos=parseInt(scroller_height)*(1)
var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
crossobj.style.top=curpos+"px"
}
function startit(){
crossobj=ie4? eval("document.all."+curcanvas) : dom? document.getElementById(curcanvas) : document.tickernsmain.document.tickernssub
if (ie4||dom){
crossobj.innerHTML=scrollercontent[curindex]
rotateslide()
}
else{
document.tickernsmain.visibility='show'
curindex++
setInterval("rotateslide()",pause)
}
}
if (ie4||dom||document.layers)
window.onload=startit
The code in betweek the //mcd1 comments is the content to be displayed... This is actually a .js file that im using at the moment, it transitions and fade but doesn't work to well in netscape...
First you would use something like:
$array1 = explode("//mcd1",$fopen("filename.js", "a+"))
Then your content data would be $array1[1], then you can use every function to replace/add/remove news...
I have already started on example code, this code will show you whats in the news file that moment, please look at the code and take it into note, its quite a highly used way for finding things you need...
<?php
$scroller_file = implode("\n",file("scroller.js")); // Get the scroller.js file
$scroller_arr1 = explode("//mcd1",$scroller_file); // Get the 3 array (FIXED-NEWS-FIXED)
$scroller_news = $scroller_arr1[1]; // Get the 2nd array (NEWS)
$scoller_news = str_replace("\'","=+~+=",$scroller_news); // Makes sure there are no implications with '
$scroller_arr2 = explode("'",$scroller_news); // Gets the actuall content data (with extra: FIXED-NEWS etc...)
for($i=0;$i<count($scroller_arr2);$i++) // Loop Through The Results
{
if(($i + 1) % 2 == 0) // Checks to see if the result is a NEWS or a FIXED text
{
$content_str .= $scroller_arr2[$i]."'~'"; // If its a NEWS text it adds it to a str seperated by "~"
}
}
$content_arr = explode("'~'",$content_str); // Explode "~" into an array to be shown
foreach($content_arr as $val){ // Loops through the different news texts
echo(str_replace("=+~+=","\'",$val)); } // Replaces the anti-implication str with the ' and echos the results
?>
I commented on all the variables etc to help you understand my wierd code a bit better... i hope this helps 😉