Single line RSS feed in iWeb

ok, I would like a single line RSS feed of CNN news to marquee across my iWEB web site.  

I can find all kinds of ways to get the CNN RSS feed on my site, but I have a very small space to work with and it'd be awesome if I could have a single line, MAYBE two line RSS feed of the CNN world news.  

Can anyone help?  I've googled until I have a headache.

thanks

cliff
crp0499CEOAsked:
Who is Participating?
 
Ray PaseurCommented:
Here is an example I wrote for another question.  The thing you want is called a scroller or a newsticker.  Check the mioplanet site for the JS.  Put your own URL on line 16 in place of the highways.gov.uk URL.

Just curious - have you got permission from CNN to use their content on your site?  If not, you might want to get permission before you do this.
<?php // RAY_rss_to_scroller.php
error_reporting(E_ALL);


// CREATE A SCROLLING NEWS TICKER FOLLOWING THE EXAMPLE SHOWN ON THIS PAGE:
// http://www.mioplanet.com/rsc/newsticker_javascript.htm
// THIS PHP CODE IMPLEMENTS THE EXAMPLE USING RSS / XML DATA SOURCE
//
//    <DIV ID="TICKER" STYLE="overflow:hidden; width:520px">
//      <?php include "RAY_rss_to_scroller.php"; ?>
//    </DIV>
//    <script type="text/javascript" src="webticker_lib.js" language="javascript"></script>


// GET THE TRAFFIC FEED
$xml = file_get_contents("http://www.highways.gov.uk/rssfeed/rss.xml");

// OR MAYBE GET THE GOOGLE NFL SPORTS FEED?
// $xml = file_get_contents("http://news.google.com/news?pz=1&cf=all&ned=us&hl=en&q=nfl+draft&cf=all&output=rss");

// MAKE IT INTO AN OBJECT
$obj = SimpleXML_Load_string($xml);

// GET THE MAIN TITLE
$str = trim((string)$obj->channel->title);

// ITERATE OVER THE OBJECT TO GATHER THE STRINGS FOR THE FEED
foreach ($obj->channel->item as $thing)
{
    $alink = trim((string)$thing->link);
    $title = trim((string)$thing->title);
    $pdate = trim((string)$thing->pubDate);

    // IF THERE IS A LINK IN THE ITEM, MAKE THE TITLE INTO A CLICKABLE LINK
    if ($alink != '')
    {
        $str .= "&nbsp; $pdate &nbsp;<a target=\"_blank\" href=\"$alink\">$title</a>&nbsp; &nbsp;";
    }
    // APPEND THIS ITEM TITLE TO THE STRING
    else
    {
        $str .= "&nbsp; $pdate &nbsp;$title&nbsp; &nbsp;";
    }
} // END ITERATOR - YOU COULD USE A COUNTER TO LIMIT THE NUMBER OF THINGS IN THE SCROLLER STRING

// PRINT THE STRING FOR THE SCROLLER
echo $str;

Open in new window

0
 
crp0499CEOAuthor Commented:
all understood except for the "check mioplanet for the the JS."  Do I need to pull something down from them and drop in a folder on my site?
0
 
Ray PaseurCommented:
Yes, I think you do.  Check this link:
http://www.mioplanet.com/rsc/newsticker_javascript.htm
0
 
Ray PaseurCommented:
Thanks for the points - good luck with it, ~Ray
0
 
crp0499CEOAuthor Commented:
thanks for the prompt and thorough reply!  Rare on here.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.