/    Sign up×
Community /Pin to ProfileBookmark

RSS Feed "This feed contains code errors" in IE8

An RSS feed that I have in my site used to work but now won’t display in IE and displays an error page saying “This feed contains code errors” and I’m totally unsure as to why as it works fine in other browsers. Can anyone scan through this code for me and tell me what the problem is:-

[code=php]

<?php

$siteurl = “http://www.mysite.co.uk/”;

require_once(‘connectionfile.php’);
mysql_select_db($database, $myconnection);

$today = date(‘Y-m-d’);

$query = “(SELECT * FROM teachers WHERE is_ranked = 1 AND type <> 3 AND expiration_date > ‘$today’) UNION (SELECT * FROM teachers WHERE type <> 3 AND expiration_date > ‘$today’)”;
$result = mysql_query($query);

while ($line = mysql_fetch_assoc($result))
{
$return[] = $line;
}

$now = date(“D, d M Y H:i:s T”);

$output = “<?xml version=”1.0″?>
<rss version=”2.0″>
<channel>
<title>teachers</title>
<link>”.$siteurl.”RSS-Feed.php</link>
<description>RSS</description>
<language>en-us</language>
<pubDate>$now</pubDate>
“;

foreach ($return as $line)
{

$teacherclass_id = $line[‘class_id’];
$result_getteacherclass = mysql_query(“SELECT * FROM classs WHERE class_id = $teacherclass_id”);
$row_getteacherclass = mysql_fetch_assoc($result_getteacherclass);

$output .= “<item><title>”.htmlentities($line[‘teacher_name’]).”</title>
<link>”.htmlentities($siteurl.$row_getteacherclass[‘class_url_name’]).”.co.uk</link>

<description>”.htmlentities(strip_tags($line[‘description’])).”</description>
<pubDate>”.htmlentities($line[‘join_date’]).”</pubDate>
</item>”;
}
$output .= “</channel></rss>”;
header(“Content-Type: application/rss+xml”);
echo $output;
?>

[/code]

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@NogDogFeb 26.2011 — What is the error? (You might want to run the page through the w3.org validator to see what it reports.)
Copy linkTweet thisAlerts:
@jimmyoneshotauthorFeb 26.2011 — It's the pound sign in the description tag turning into &pound; How would I replace that with syntax that the feed would display ok with in my above code?
Copy linkTweet thisAlerts:
@NogDogFeb 26.2011 — Try using htmlspecialchars() instead of htmlentities() throughout. (Strict XML only supports something like 4 or 5 character entities -- basically the things that htmlspecialchars() affects.)

Alternatively, you could wrap text in [B]<![CDATA[[/B] ... [B]]]>[/B] tags (only applies to text between opening/closing XML tags, but not text that is inside a tag as an attribute value).
Copy linkTweet thisAlerts:
@jimmyoneshotauthorMar 08.2011 — Thanks nog dog. It's fixed now.

I used <?xml version="1.0" encoding="iso-8859-1"?> to set the encoding and used cdata tags as you suggested and simply removed all the html entities parts and just echoed stuff straight out instead.

All the best.
×

Success!

Help @jimmyoneshot spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...