Hi everyone.
It has been some time since I have done any coding (perl) and I am running into a bit of a headache. I am using some PHP and JS I downloaded from your site (http://www.dynamicdrive.com/dynamici...pausescroller/) and I am putting a weather RRS feed on a web-page I am creating. The RSS is working as I am getting the information into my HTML browser but it is having and ° in the output and not a space and degree symbol. I know from my long past days of perl that you can replace those with spaces and characters. I am still looking around the net for answers currently.... I looked into the PHP script and I think I have identified the place for the replacement of the values when outputting it into javascript:
I have tried to changePHP Code:// -------------------------------------------------------------------
// outputRSS_JS()- Outputs the "title", "link", "description", and "pubDate" elements of an RSS
feed in XML format
// -------------------------------------------------------------------
function outputRSS_JS($url, $divid) {
global $rss;
if ($rs = $rss->get($url)){
echo "rsscontentdata.$divid=new Array();\n";
$i=0;
foreach ($rs['items'] as $item) {
echo "rsscontentdata.$divid" . "[$i]={link:\"" . slashit($item[link]) . "\",
title:\"" . slashit($item[title]) . "\", description:\"" . slashit($item[description]) . "\",
date:\"" . slashit($item[pubDate]) . "\"}\n";
$i++;
}
if ($rs['items_count'] <= 0) { echo "rsscontentdata=\"Sorry, no items found in the RSS
file\""; }
}
else {
echo "rsscontentdata=\"Sorry: It's not possible to reach RSS file $url\"";
// All else fails
}
}
function slashit($what){ //Encode text for storing in JavaScript array
$newstring=str_replace(''', '\'', $what);//replace those half valid apostrophe entities with actual apostrophes
return rawurlencode($newstring);
}
toPHP Code:$newstring=str_replace(''', '\'', $what);
and that isn't working in the output as I still see " ".PHP Code:$newstring=str_replace(' ', ' ', $what);
Any suggestions on how to replace the " " and "°" in the PHP script?
Thanks for the patience.....



Reply With Quote
Bookmarks