PDA

View Full Version : rss pause scroller has espn feed blank



kkhenson
02-06-2007, 04:34 AM
1) Script Title:
Pausing RSS Scroller
2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex17/rsspausescroller/index.htm
3) Describe problem:
I ran through the demo fine, and even added my own .rss file which shows up great. When I add the espn feeds, however, the content is blank, nothing appears.

Here's the link to my feeds, the 3rd box at the bottom is the espn mlb headlines:
http://www.rose14.com/php/foo.php

I have this in the scrollerbridge.php:
// Define your list of RSS URLs- "RSS_id"=> "URL to RSS feed"
$rsslist=array(
"cnn" => "http://rss.cnn.com/rss/cnn_topstories.rss",
"espnmlb" => "http://sports.espn.go.com/espn/rss/mlb/news",
"espntop" => "http://sports.espn.go.com/espn/rss/news",
"gammons" => "http://search.espn.go.com/keyword/search?searchString=peter_gammons&page=espn&filter=null&feed=rss",
"alb" => "http://www.rose14.com/rss/albscores.rss",
"bbc" => "http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml",
"news.com" => "http://news.com.com/2547-1_3-0-5.xml",
"slashdot" => "http://rss.slashdot.org/Slashdot/slashdot",
"dynamicdrive" => "http://www.dynamicdrive.com/export.php?type=new",
);

and in my top php, the foo.php from my link, I have this:
new rsspausescroller("alb", "pscroller1", "rssclass", 3000, "_new")

document.write("<br />") //add a divider for demo

new rsspausescroller("dynamicdrive", "pscroller2", "rssclass", 3000, "", "date+description")

document.write("<br />") //add a divider for demo

new rsspausescroller("espnmlb", "pscroller3", "rssclass", 3000, "_new", "date")
document.write("<br />") //add a divider for demo

I just can't seem to figure out why the ESPN MLB feed is coming in blank?

thanks,
kevin

kkhenson
02-06-2007, 02:07 PM
I did try accessing the espn feed using this link:
http://www.rose14.com/rss/lastrss/scrollerbridge.php?id=espnmlb

And I see data like this:
rsscontentdata.=new Array();
rsscontentdata.[0]={link:"http%3A%2F%2Fsports.espn.go.com%2Fmlb%2Fhotstove06%2Fcolumns%2Fstory%3Fcolumnist%3Dstark_jayson%26amp%3Bid%3D2752428%26amp%3Bcampaign%3Drss%26amp%3Bsource%3DMLB Headlines", title:"%3C%21%5BCDATA%5BStark%3A%20Spending%20spree%20puts%20Cubs%20on%20the%20spot%5D%5D%3E", description:"%3C%21%5BCDATA%5BAfter%20spending%20nearly%20%24300%20million%20on%20free%20agents%20this%20offseason%2C%20expectations%20have%20greatly%20increased%20for%20the %20Cubs.%5D%5D%3E", date:"Feb%2005%2C%202007%205%3A14%3A38%20PM"}
rsscontentdata.[1]={link:"http%3A%2F%2Fsports.espn.go.com%2Fespn%2Fnews%2Fstory%3Fid%3D2755154%26amp%3Bcampaign%3Drss%26amp%3Bsource%3DMLBHeadlines", title:"%3C%21%5BCDATA%5BNYC%20flight%20restrictions%20after%20Lidle%20crash%20to%20be%20permanent%5D%5D%3E", description:"%3C%21%5BCDATA%5BFlight%20restrictions%20imposed%20around%20Manhattan%20after%20New%20York%20Yankee%20pitcher%20Cory%20Lidle%20crashed%20his%20single-engine%20plane%20into%20an%20apartment%20tower%20will%20be%20made%20permanent%2C%20new%20government%20documents%20show.%5D%5D%3E", date:"Feb%2005%2C%202007%203%3A57%3A55%20PM"}

That makes me think at least the feed is being retrieved, but somehow isn't being displayed.

ddadmin
02-06-2007, 10:21 PM
It's possible the script could be timing out while trying to fetch the espn feed. Can you put up an example again of the ESPN feed on your page?

kkhenson
02-06-2007, 10:38 PM
Oh shoot, I did mess around with this some more today and took off my espn attempt. I just uploaded the file again, but my site or the host is having some issues, as I cannot seem to bring up any of my html on it. Maybe in a couple of hours it'll be back to normal and at that time, the original foo.php will be in place.

Here's the link again:
http://www.rose14.com/php/foo.php

Thanks very much for taking a look.

kev

ddadmin
02-07-2007, 08:29 AM
Ok, I've found the problem, though not necessarily an immediate solution. Basically the ESPN feed is formatted in a way that, when the RSS scroller script encodes it so it can be stored as a JavaScript array, then decoding it back on the client side using JavaScript's unescape function, the result is invalid HTML resulting in a blank output. The output is there, it's just that there's some sort of invalid HTML within it that makes the browser show nothing.

The function within scrollerbridge.php that encodes the incoming RSS feed is the following:


function slashit($what){ //Encode text for storing in JavaScript array
$newstring=str_replace('&apos;', '\'', $what); //replace those half valid apostrophe entities with actual apostrophes
return rawurlencode($newstring);
}

You can try commenting out the "$newstring" line and have the script skip this operation to see if it helps. The result is:


function slashit($what){ //Encode text for storing in JavaScript array
//$newstring=str_replace('&apos;', '\'', $what); //replace those half valid apostrophe entities with actual apostrophes
return rawurlencode($what);
}

Then again, even if this works, this may cause the output of the other "normal" RSS feeds on your page to become a little wacky. Ultimately I want to update this script to use a different PHP RSS parsing class, from the current LastRSS to Simplepie.org. The later is a lot more versatile and takes care of a lot of encoding problems automatically.

kkhenson
02-07-2007, 01:06 PM
I really appreciate you taking the time to look at this. I did make the change, but the result doesn't appear to be any different. I'll take a look at the simplepie just to see if I can understand it, and give it a shot to see if it displays correctly. I can always revisit the pausing scroll later on.

kev