PDA

View Full Version : RSS Feed Text = Good / ATOM Feed Text = Not Good


gorin-images
04-25-2007, 07:36 AM
I recently updated to Pixelpost 1.6.0. It is awesome. As part of my new install quality checking, I have tested out my RSS and ATOM feeds in various readers.

Both feeds are getting all of the correct information from my site, including the image thumbnail. However, the text portion of the RSS feed is coming through "clean" and looks like it does on my photoblog pages. The ATOM feed shows all of the text, but also shows any CODE that is present in my photoblog post.

Here is an example. Both of the following are from the exact same post on my photoblog, with no modifications.

Viewing the RSS feed, the text looks like this in the reader:

A honey bee rests on the back step of a delivery truck behind SB MailWorks in Old Town Goleta, California.

This is a hand-held macro image, using available natural light. Fortunately, this bee was not moving around alot and did not appear to feel threatened by the camera, which was only a few inches from it when making this image.

Also, this past weekend I upgraded my photoblog software to Pixelpost 1.6.0. Everything appears to be working correctly so far. However, if you observe any strange behavior or errors, I would appreciate it if you would send me an E-mail.

Viewing the ATOM feed, the identical text looks like this in the reader:

A honey bee rests on the back step of a delivery truck behind <b><a href="http://www.sbmailworks.com/home.html" target="_blank">SB MailWorks</a></b> in Old Town Goleta, California. This is a hand-held macro image, using available natural light. Fortunately, this bee was not moving around alot and did not appear to feel threatened by the camera, which was only a few inches from it when making this image. Also, this past weekend I upgraded my photoblog software to <b><a href="http://www.pixelpost.org" title="Click this link to open the Pixelpost home page where you can download the excellent, and FREE software to run your photoblog." target="_blank">Pixelpost 1.6.0</a></b>. Everything appears to be working correctly so far. However, if you observe any strange behavior or errors, I would appreciate it if you would send me an <b><a href="mailto:jarrett@gorin-images.com?subject=Gorin-Images%20Problem%20Report%20Following%20Pixelpost% 20v1.6.0%20Upgrade">E-mail</a></b>.

I have checked this out with two different readers and get the same results in each case.

How can I edit the Functions-Feeds file so that "clean" text will show up in the ATOM feed also?

P.S. If I have posted this in the incorrect discussion section, please re-locate it to the correct place. Thanks.

jaywilliams
04-25-2007, 02:42 PM
Go to includes/function_feeds.php @ line # 190

You should see this:
$headline = pullout($headline);
$headline = htmlspecialchars($headline,ENT_QUOTES);
$body = pullout($body);
$body = htmlspecialchars($body,ENT_QUOTES);
$body = strip_tags($body);
$image = $cfgrow['siteurl'].$rsspicdir.$image;
$tag_date =substr($datetime,0,10);
$id_date = substr($datetime,0,10);
$tag_time = substr($datetime,11,8);
$tag_date .=T;
$tag_date .=$tag_time;
$tag_date .=Z;

REPLACE the code with this:

$headline = pullout($headline);
$headline = htmlspecialchars($headline,ENT_QUOTES);
$body = pullout($body);
$body = stripslashes($body);
$body = strip_tags( $body);
$body = htmlspecialchars($body,ENT_QUOTES);
$body = ereg_replace("\n","\n&lt;br /&gt;",$body);
$image = $cfgrow['siteurl'].$rsspicdir.$image;
$tag_date =substr($datetime,0,10);
$id_date = substr($datetime,0,10);
$tag_time = substr($datetime,11,8);
$tag_date .=T;
$tag_date .=$tag_time;
$tag_date .=Z;

ATOM feeds are now clean like the RSS feeds.

gorin-images
04-25-2007, 05:59 PM
Thanks for the detailed reply! I will try this tonight and post back with the results.

gorin-images
04-26-2007, 06:21 AM
@jaywilliams

OK. I just modified the code in my ATOM feed per your direction. It has solved part of the problem, but not all of it. It got rid of all of the link information showing up in the feed text. But it still isn't showing line breaks correctly.

Here is an updated Example:

Viewing the RSS feed, the text looks like this:

A honey bee rests on the back step of a delivery truck behind SB MailWorks in Old Town Goleta, California.

This is a hand-held macro image, using available natural light. Fortunately, this bee was not moving around alot and did not appear to feel threatened by the camera, which was only a few inches from it when making this image.

Also, this past weekend I upgraded my photoblog software to Pixelpost 1.6.0. Everything appears to be working correctly so far. However, if you observe any strange behavior or errors, I would appreciate it if you would send me an E-mail.

Viewing the ATOM feed, after modding the code as directed, the text looks like this:

A honey bee rests on the back step of a delivery truck behind SB MailWorks in Old Town Goleta, California. <br /> <br />This is a hand-held macro image, using available natural light. Fortunately, this bee was not moving around alot and did not appear to feel threatened by the camera, which was only a few inches from it when making this image. <br /> <br />Also, this past weekend I upgraded my photoblog software to Pixelpost 1.6.0. Everything appears to be working correctly so far. However, if you observe any strange behavior or errors, I would appreciate it if you would send me an E-mail.

I am duplicating these results in two different feed readers (the built-in one in Internet Explorer 7 and Omea Reader).

As you can see, for some reason it isn't actually inserting the line breaks, and it is showing the code for the line breaks. How can I mod the code further so that my ATOM feed looks just like the RSS feed?

jaywilliams
04-26-2007, 02:13 PM
Whoops, it looks like I made a little mistake with the code.

Go to includes/function_feeds.php (Line #196)

Find this code:
$body = ereg_replace("\n","\n&lt;br /&gt;",$body);

Replace it with this:
$body = ereg_replace("\n","\n<br />",$body);

That should solve the problem.

gorin-images
04-26-2007, 04:56 PM
Yes. That fixed it. Thank you!

Now, I'd like to find out how I can make html hyperlinks in my photoblog notes descriptions translate through as html hyperlinks in my feeds. Should I post that in a different/new topic?

If you want to see an example of this, check out the RSS feed for Chromasia.

jaywilliams
04-26-2007, 05:30 PM
This can be done as well.

Go to includes/function_feeds.php (Line #50)

Find this:
$body = strip_tags($body);

Replace it with this:
$body = strip_tags($body,"<a>");

Go to includes/function_feeds.php (Line #194)

Find this:
$body = strip_tags($body);
$body = htmlspecialchars($body,ENT_QUOTES);

Replace it with this:
$body = strip_tags($body,'<a>');
#$body = htmlspecialchars($body,ENT_QUOTES);

That should do it. ;-)

gorin-images
04-27-2007, 05:54 AM
Yes sir. That did it! You rock jaywilliams.

So I guess, since this code is known, and it works, and provides nice clean feeds in both ATOM and RSS, including active hyperlinks, then why isn't it included as part of the stock code in Pixelpost? Maybe in the next release?

I bet you guys could even key this to some nice admin option field like "show active hyperlinks in feeds? Yes/No (in drop down menu).

I can't thank you enough for your help with this. :)

jaywilliams
04-27-2007, 01:27 PM
We'll definitely include the clean ATOM code into the next release. But the hyperlinks in feeds would take a bit more work. The current method I used was a little 'rough' and it wouldn't work very well for our international users.