?
Solved

Single line RSS feed in iWeb

Posted on 2011-05-03
5
Medium Priority
?
2,943 Views
Last Modified: 2013-11-18
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
0
Comment
Question by:crp0499
  • 3
  • 2
5 Comments
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 35691313
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
 

Author Comment

by:crp0499
ID: 35691365
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
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 35691401
Yes, I think you do.  Check this link:
http://www.mioplanet.com/rsc/newsticker_javascript.htm
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 35691515
Thanks for the points - good luck with it, ~Ray
0
 

Author Comment

by:crp0499
ID: 35691546
thanks for the prompt and thorough reply!  Rare on here.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question