Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: xml newsticker

  1. #1
    New Coder
    Join Date
    Feb 2008
    Location
    England
    Posts
    31
    Thanks
    6
    Thanked 0 Times in 0 Posts

    xml newsticker

    Hi,

    i would like to have a news ticker that scrolls the guardian environment page (http://www.guardian.co.uk/environment/rss) horizontally.

    I have been using rss to javascript to get the first part of the code(http://www.rss-to-javascript.com/) but am having trouble getting the second part.

    I have tried using a javascript webticker to work but it just did nothing. Has anyone else had the same issue, i would appreciate any kind of input that will help do this.

    James

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Hi,
    I follow the steps from the links you posted and after 20 minutes I make it work somehow with major modification of the generated code. It have a lot of invalid markup, for a xhtml strict page, and I can't make it work until I removed the noscript part and the last two links to rss-to-javascript site. This last change probably don't fit in their TOS and I guess is not legal, I didn't check.
    Sorry, I suggest to find another way to do that.

    regards

  • Users who have thanked oesxyl for this post:

    dewy (06-23-2008)

  • #3
    New Coder
    Join Date
    Feb 2008
    Location
    England
    Posts
    31
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Ok so i have modified a scroller to work with my guardian rss. there are two html pages which join

    This one should be called "news_win.htm"
    Code:
    <html><head>
    
    <title>News</title>
    
    <base target="_blank">
    
    <style type="text/css">
    <!--
    BODY 		{ margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color:white; background-color:black; font:sans-serif;}
    
    
     /* FONT COLORS */
    
    
    
    #NewsDiv	{ position: absolute;width: 100&#37; }
    
     /* PAGE LINK COLORS */
    
    a:link		{ color: white; text-decoration: none; line-height:50px; border-bottom: thin solid blue;  }
    
    a:visited	{ color: white; text-decoration: none; }
    
    a:active	{ color: white; text-decoration: none; }
    
    a:hover		{ color: white; text-decoration: none; }
    
    li {list-style:none;}
    
    
    -->
    </style>
    
    </head>
    
    <BODY BGCOLOR="#FFFFFF" TEXT="#000000" leftmargin="0" onMouseover="scrollspeed=0" onMouseout="scrollspeed=current" OnLoad="NewsScrollStart();">
    
    <div id="NewsDiv">
    
    
    
    <!-- SCROLLER CONTENT STARTS HERE -->
    
    <script language="JavaScript" src="http://itde.vccs.edu/rss2js/feed2js.php?src=http%3A%2F%2Fwww.guardian.co.uk%2Fenvironment%2Frenewableenergy%2Frss&chan=y&num=0&desc=0&date=y&targ=y" type="text/javascript"></script>
    
    <noscript>
    <a href="http://itde.vccs.edu/rss2js/feed2js.php?src=http%3A%2F%2Fwww.guardian.co.uk%2Fenvironment%2Frenewableenergy%2Frss&chan=y&num=0&desc=0&date=y&targ=y&html=y">View RSS feed</a>
    </noscript>
    <br/>
    
    
    
    
    <br>
    
    
    
    
    <!-- SCROLLER CONTENT ENDS HERE -->
    
    
    
    </td></tr></table>
    </div>
    
    
    <script language="JavaScript" type="text/javascript">
    <!-- HIDE CODE
    
    var scrollspeed		= "1"		// SET SCROLLER SPEED 1 = SLOWEST
    var speedjump		= "40"		// ADJUST SCROLL JUMPING = RANGE 20 TO 40
    var startdelay 		= "2" 		// START SCROLLING DELAY IN SECONDS
    var nextdelay		= "2" 		// SECOND SCROLL DELAY IN SECONDS 0 = QUICKEST
    var topspace		= "15px"		// TOP SPACING FIRST TIME SCROLLING
    var frameheight		= "100px"	// IF YOU RESIZE THE WINDOW EDIT THIS HEIGHT TO MATCH
    
    
    
    current = (scrollspeed)
    
    
    function HeightData(){
    AreaHeight=dataobj.offsetHeight
    if (AreaHeight==0){
    setTimeout("HeightData()",( startdelay * 1000 ))
    }
    else {
    ScrollNewsDiv()
    }}
    
    function NewsScrollStart(){
    dataobj=document.all? document.all.NewsDiv : document.getElementById("NewsDiv")
    dataobj.style.top=topspace
    setTimeout("HeightData()",( startdelay * 1000 ))
    }
    
    function ScrollNewsDiv(){
    dataobj.style.top=parseInt(dataobj.style.top)-(scrollspeed)
    if (parseInt(dataobj.style.top)<AreaHeight*(-1)) {
    dataobj.style.top=frameheight
    setTimeout("ScrollNewsDiv()",( nextdelay * 1000 ))
    }
    else {
    setTimeout("ScrollNewsDiv()",speedjump)
    }}
    
    
    
    // END HIDE CODE -->
    </script>
    
    
    </body>
    </html>
    and here is the second, which can be called anything as no information is being taken out of anywhere.
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>News</title>
    </head>
    <style type="text/css">
    body {background-color:#333333;font:sans-serif; color:#FFFFFF;}
    p {font:Verdana, Arial, Helvetica, sans-serif}
    #container {
    	width:800px;
    	margin-left:auto;
    	margin-right:auto;
    	background-color:black;
    	padding: 5px;
    }
    
    </style>
    <body>
    <div id="container">
    
    <!-- COPY THIS CODE TO PASTE INTO ANY HTML PAGE -->
    <table>
    <tr>
    <td>
    <iframe id="NewsWindow" src="news_win.htm" width="700" height="100" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" style="border: #000000 1px solid;"></iframe>
    </td></tr>
    <tr>
    <td><p>Hover over to stop</p></td>
    </tr></table>
    <br><br>
    <!-- END CODE -->
    </div>
    
    </body>
    </html>
    It would be great if the news scrolled in from the right, if anyone can help that would be great. but i am quite happy with the results so far.
    Last edited by Alex Vincent; 06-24-2008 at 01:43 AM. Reason: Adding in [code][/code] tags.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •