cavs_playa23
02-09-2007, 05:42 PM
I have an invisionfree forum and I wish to make an RSS feed to put in there.
This is what it is supposed to looks like http://www.mediamogulsweb.com/client/scroll_news/rumors2.php .
This is the code I put in
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<style type="text/css">
<!--
body
{
margin:0;
}
#newsDiv
{
position:absolute;
width:600px;
left:50%;
margin:50px 0 0 -300px;
height:200px;
border:1px solid #000;
background-color:#FFF;
overflow:hidden;
}
#newsDiv h3
{
font:bold 14px Verdana,Arial;color:#BB0000;
margin:0 0 20px 0;
padding:0 0 3px 0;
border-bottom:2px solid #000;
width:100%;
}
#feed
{
position:absolute;
width:560px;
left:50%;
margin:0 0 0 -280px;
}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<script type="text/javascript">
<!--
var speed = 1;
var clipTop = 0;
var clipBottom = 360;
var timer;
var dir = 1;
function scrollNewsDown(id)
{
var divObj = document.getElementById(id);
if (Math.abs(parseInt(divObj.style.top)) + 350 < divObj.offsetHeight)
{
clipTop += speed;
clipBottom += speed;
divObj.style.top = parseInt(divObj.style.top) - speed + "px";
divObj.style.clip = 'rect('+clipTop+'px,560px,'+clipBottom+'px,0)';
timer = setTimeout('scrollNewsDown("'+id+'")',10);
}
else
{
dir = 2;
scrollNewsUp(id);
}
}
function scrollNewsUp(id)
{
var divObj = document.getElementById(id);
if (parseInt(divObj.style.top) < 50)
{
clipTop -= speed;
clipBottom -= speed;
divObj.style.top = parseInt(divObj.style.top) + speed + "px";
divObj.style.clip = 'rect('+clipTop+'px,560px,'+clipBottom+'px,0)';
timer = setTimeout('scrollNewsUp("'+id+'")',10);
}
else
{
dir = 1;
scrollNewsDown(id);
}
}
function pauseScroll(id,state)
{
if (state == 1)
{
clearTimeout(timer);
}
else if (state == 2)
{
if (dir == 1)
scrollNewsDown(id);
else if (dir == 2)
scrollNewsUp(id);
}
}
-->
</script>
<?
// RSS news feed setup
include "rss_fetch.php"; //include class code from the current directory
$url = "http://sports.yahoo.com/nba/rumors/rss.xml"; //RSS Feed to parse
$show = 10; //Show the latest 10 headlines
$html = "<span class='body2'>(#{pubDate})</span>
<p class='body4'><a href='#{link}' target='_new' class=c>#{title}</a></p>
<div class='feeds'>#{description}</div>
<div class='line'> </div>"; //HTML code
$update = 0; //Dont update if its older
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" dir="ltr">
<head>
<title>NBA Rumors News Ticker</title>
<style type="text/css">
<!--
body
{
margin:0;
}
#newsDiv
{
position:absolute;
width:600px;
left:50%;
margin:50px 0 0 -300px;
height:400px;
border:1px solid #000;
background-color:#eee;
overflow:hidden;
}
#newsDiv h3
{
font:bold 14px Verdana,Arial;
margin:0 0 20px 0;
padding:0 0 3px 0;
border-bottom:1px solid #000;
width:100%;
}
#feed_container
{
position:absolute;
width:560px;
left:50%;
margin:0 0 0 -280px;
}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<script type="text/javascript">
<!--
var speed = 1;
var clipTop = 0;
var clipBottom = 360;
var timer;
var makeDiv = 0;
function scrollNews(id)
{
var divObj = document.getElementById(id);
var divArr = divObj.getElementsByTagName('div');
if (parseInt(divObj.style.top)/divArr.length < 0 && makeDiv == 0)
{
var feed2 = document.createElement("div");
divObj.appendChild(feed2);
divArr[divArr.length-1].innerHTML = divArr[0].innerHTML;
makeDiv = 1;
}
clipTop += speed;
clipBottom += speed;
divObj.style.top = parseInt(divObj.style.top) - speed + "px";
divObj.style.clip = 'rect('+clipTop+'px,560px,'+clipBottom+'px,0)';
timer = setTimeout('scrollNews("'+id+'")',10);
if (Math.abs(parseInt(divObj.style.top)) + 400 > divObj.offsetHeight)
makeDiv = 0;
}
function pauseScroll(id,state)
{
if (state == 1)
clearTimeout(timer);
else if (state == 2)
scrollNews(id);
}
-->
</script>
</head>
<body onload="scrollNews('feed_container');">
<div id="newsDiv">
<div id="feed_container" style="top:20px;clip:rect(0,560px,360px,0)" onmouseover="pauseScroll('feed_container',1);" onmouseout="pauseScroll('feed_container',2);">
<div>
<h3>Today's NBA Rumors <i>(courtesy of Yahoo! Sports)</i></h3><?
// Display RSS news feed
$rss = new rss_parser($url, $show, $html, $update);
?></div>
</div>
</div>
</body>
</html>
Why doesn't it work? Please help
Thanks.
This is what it is supposed to looks like http://www.mediamogulsweb.com/client/scroll_news/rumors2.php .
This is the code I put in
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<style type="text/css">
<!--
body
{
margin:0;
}
#newsDiv
{
position:absolute;
width:600px;
left:50%;
margin:50px 0 0 -300px;
height:200px;
border:1px solid #000;
background-color:#FFF;
overflow:hidden;
}
#newsDiv h3
{
font:bold 14px Verdana,Arial;color:#BB0000;
margin:0 0 20px 0;
padding:0 0 3px 0;
border-bottom:2px solid #000;
width:100%;
}
#feed
{
position:absolute;
width:560px;
left:50%;
margin:0 0 0 -280px;
}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<script type="text/javascript">
<!--
var speed = 1;
var clipTop = 0;
var clipBottom = 360;
var timer;
var dir = 1;
function scrollNewsDown(id)
{
var divObj = document.getElementById(id);
if (Math.abs(parseInt(divObj.style.top)) + 350 < divObj.offsetHeight)
{
clipTop += speed;
clipBottom += speed;
divObj.style.top = parseInt(divObj.style.top) - speed + "px";
divObj.style.clip = 'rect('+clipTop+'px,560px,'+clipBottom+'px,0)';
timer = setTimeout('scrollNewsDown("'+id+'")',10);
}
else
{
dir = 2;
scrollNewsUp(id);
}
}
function scrollNewsUp(id)
{
var divObj = document.getElementById(id);
if (parseInt(divObj.style.top) < 50)
{
clipTop -= speed;
clipBottom -= speed;
divObj.style.top = parseInt(divObj.style.top) + speed + "px";
divObj.style.clip = 'rect('+clipTop+'px,560px,'+clipBottom+'px,0)';
timer = setTimeout('scrollNewsUp("'+id+'")',10);
}
else
{
dir = 1;
scrollNewsDown(id);
}
}
function pauseScroll(id,state)
{
if (state == 1)
{
clearTimeout(timer);
}
else if (state == 2)
{
if (dir == 1)
scrollNewsDown(id);
else if (dir == 2)
scrollNewsUp(id);
}
}
-->
</script>
<?
// RSS news feed setup
include "rss_fetch.php"; //include class code from the current directory
$url = "http://sports.yahoo.com/nba/rumors/rss.xml"; //RSS Feed to parse
$show = 10; //Show the latest 10 headlines
$html = "<span class='body2'>(#{pubDate})</span>
<p class='body4'><a href='#{link}' target='_new' class=c>#{title}</a></p>
<div class='feeds'>#{description}</div>
<div class='line'> </div>"; //HTML code
$update = 0; //Dont update if its older
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" dir="ltr">
<head>
<title>NBA Rumors News Ticker</title>
<style type="text/css">
<!--
body
{
margin:0;
}
#newsDiv
{
position:absolute;
width:600px;
left:50%;
margin:50px 0 0 -300px;
height:400px;
border:1px solid #000;
background-color:#eee;
overflow:hidden;
}
#newsDiv h3
{
font:bold 14px Verdana,Arial;
margin:0 0 20px 0;
padding:0 0 3px 0;
border-bottom:1px solid #000;
width:100%;
}
#feed_container
{
position:absolute;
width:560px;
left:50%;
margin:0 0 0 -280px;
}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<script type="text/javascript">
<!--
var speed = 1;
var clipTop = 0;
var clipBottom = 360;
var timer;
var makeDiv = 0;
function scrollNews(id)
{
var divObj = document.getElementById(id);
var divArr = divObj.getElementsByTagName('div');
if (parseInt(divObj.style.top)/divArr.length < 0 && makeDiv == 0)
{
var feed2 = document.createElement("div");
divObj.appendChild(feed2);
divArr[divArr.length-1].innerHTML = divArr[0].innerHTML;
makeDiv = 1;
}
clipTop += speed;
clipBottom += speed;
divObj.style.top = parseInt(divObj.style.top) - speed + "px";
divObj.style.clip = 'rect('+clipTop+'px,560px,'+clipBottom+'px,0)';
timer = setTimeout('scrollNews("'+id+'")',10);
if (Math.abs(parseInt(divObj.style.top)) + 400 > divObj.offsetHeight)
makeDiv = 0;
}
function pauseScroll(id,state)
{
if (state == 1)
clearTimeout(timer);
else if (state == 2)
scrollNews(id);
}
-->
</script>
</head>
<body onload="scrollNews('feed_container');">
<div id="newsDiv">
<div id="feed_container" style="top:20px;clip:rect(0,560px,360px,0)" onmouseover="pauseScroll('feed_container',1);" onmouseout="pauseScroll('feed_container',2);">
<div>
<h3>Today's NBA Rumors <i>(courtesy of Yahoo! Sports)</i></h3><?
// Display RSS news feed
$rss = new rss_parser($url, $show, $html, $update);
?></div>
</div>
</div>
</body>
</html>
Why doesn't it work? Please help
Thanks.