Welcome to Geeklog, Anonymous Wednesday, November 27 2024 @ 03:46 pm EST
Geeklog Forums
Displaying HTML formatting in an RSS feed
Status: offline
lfalfa
Forum User
Newbie
Registered: 04/01/04
Posts: 12
I was unhappy that my RSS feed stripped out HTML formatting. So I hacked rss.feed.class.php so that it no longer stripped out the tags.
The change was on line 205 in method _formatContent().
Change:
$storytext = trim (strip_tags ($text));
To:
$storytext = trim ($text);
This doesn't seem to cause any ill effects in a typical story, but of course if your story contained tags that interfered with the RSS feed's tags, you'd end up with an invalid feed. Your mileage may vary, and so on.
The change was on line 205 in method _formatContent().
Change:
Text Formatted Code
$storytext = trim (strip_tags ($text));
To:
Text Formatted Code
$storytext = trim ($text);
This doesn't seem to cause any ill effects in a typical story, but of course if your story contained tags that interfered with the RSS feed's tags, you'd end up with an invalid feed. Your mileage may vary, and so on.
14
13
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Hmm, have you checked your RSS feed for validity after that change? If it's not valid RSS, many feed readers won't be able to read your feed any more ...
bye, Dirk
bye, Dirk
14
12
Quote
Status: offline
lfalfa
Forum User
Newbie
Registered: 04/01/04
Posts: 12
Thanks for the tip. I just checked, and it's validating as well as it did before I removed the strip_tags() call. It's still failing because my HTML editor plug-in inserts curly-quotes as high-bit characters (bad) instead of as HTML entities (good). I've kinda stopped using the HTML editor plug-in anyway, though, so this shouldn't be a big deal in the future.
14
27
Quote
Status: offline
lfalfa
Forum User
Newbie
Registered: 04/01/04
Posts: 12
Another change I decided to make to the class is to turn off HTML quoting. I realized that some feed readers de-quote quoted HTML, but others (notably BlogLines) don't. On line 214, change:
return htmlspecialchars($storytext);
to:
return $storytext;
Text Formatted Code
return htmlspecialchars($storytext);
to:
Text Formatted Code
return $storytext;
16
14
Quote
All times are EST. The time is now 03:46 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content