View Full Version : RSS feed not working
rtsnoz
01-11-2007, 09:06 AM
I'm having problems with my RSS feed... just doesn't seem to work. Any ideas?
http://www.rohanthomson.com/photos/index.php?x=rss
using the feed validator you can see i get this result... How do i fix this?
http://www.feedvalidator.org/check.cgi?url=http://www.rohanthomson.com/photos/index.php?x=rss
Thanks in advance
Rohan
Dennis
01-11-2007, 10:23 AM
what do you have installed as addons?
rtsnoz
01-12-2007, 01:00 AM
As well as the standard pp addons i have:
view counter - ON
random thumbs - off
random image - on
extra exif - on
akismet comment filter - on
photo ratings - off
Dennis
01-12-2007, 04:30 AM
Try turning all custom addons off and test the RSS feed.
austriaka
01-12-2007, 05:51 AM
did you hack the index.php?
There are two empty lines in the beginning of your xml. The xml declaration must be in first line!
KArin
rtsnoz
01-12-2007, 09:04 AM
I tried the addons thing with no luck.
I have hacked the index.php file slightly however i think the only thing i've done is alter it slightly for my URI structure.
here is my XML stuff any obvious problems here? (i don't understand html this well)
// ################################################## ########################################//
// RSS 2.0 FEED
// ################################################## ########################################//
if(isset($_GET['x'])&&$_GET['x'] == "rss")
{
$output = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<rss version=\"2.0\">
<channel>
<title>".$pixelpost_site_title."</title>
<link>".$cfgrow['siteurl']."</link>
<description>$pixelpost_site_title photoblog</description>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<generator>pixelpost</generator>
";
$tzoner = $cfgrow['timezone'];
$tprefix = '+';
$tzoner = sprintf ("%01.2f", $tzoner);
if (substr($tzoner,0,1)=='-')
{
$tzoner = (substr($tzoner,1));
$tprefix = '-';
}
if ($tzoner < 10) $tzoner = "0".$tzoner;
$hh = substr($tzoner,0,2);
$mm = substr($tzoner,-2);
$tzoner = $tprefix.$hh.$mm;
$query = mysql_query("SELECT id,datetime,headline,body,image FROM ".$pixelpost_db_prefix."pixelpost WHERE (datetime<='$cdate') ORDER BY datetime desc limit 10");
while(list($id,$datetime,$headline,$body,$image) = mysql_fetch_row($query))
{
$headline = pullout($headline);
$headline = htmlspecialchars($headline,ENT_QUOTES);
$image = $cfgrow['siteurl']."thumbnails/thumb_$image";
$datetime = strtotime($datetime);
$datetime =date("D, d M Y H:i",$datetime);
$datetime .= ' ' .$tzoner;
$body = pullout($body);
$body = stripslashes($body);
$body = ereg_replace("\n","\n<br />",$body);
$body = strip_tags( $body );
$body = htmlspecialchars($body,ENT_QUOTES);
$output .= "
<item>
<title>$headline</title>
<link>".$cfgrow['siteurl']."?showimage=$id</link>
<description>
<img src="$image">
<br />$body
</description>
<pubDate>$datetime</pubDate>
<guid>".$cfgrow['siteurl']."index.php?showimage=$id</guid>
</item>
";
}
$output .= "
</channel>
</rss>";
header("Content-type:application/xml");
echo $output;
exit;
}
austriaka
01-12-2007, 09:11 AM
no, I guess the failure is somewhere in the beginning of your site. The rss part of your code looks exactly like mine :-)
Somewhere you inserted two empty lines in Sourcecode. Look for \n\n or for needless linebreaks in the absolute beginning of output code. You have an additional empty line in HTML source code of http://www.rohanthomson.com/photos/index.php as well, but in HTML source code obviously this doesn't matter anyway
KArin
rtsnoz
01-12-2007, 01:46 PM
hmmm. could i just download pixelpost. and replace the index.php file with a clean one. And then make the small easy alterations for my URI stuff?
rtsnoz
01-12-2007, 01:58 PM
hmmm... i replaced the index.php file with a clean just downloaded one. This hasn't fixed the problem....
austriaka
01-12-2007, 04:56 PM
did you upload it as ASCII?
LGK
rtsnoz
01-12-2007, 10:57 PM
I'm not sure if i originally uploaded it as ASCII. However, i just reuploaded it, and before i did, i used the "convert to ASCII" tool in bbedit.
Is this the right thng to do?
Dennis
01-13-2007, 07:11 AM
[edit] I need to read better in the morning. Thank god I'll be getting my glasses soon
When you upload through FTP you have to treat the files as ASCII because binaries are mostly zip files and stuff.
austriaka
01-13-2007, 07:41 AM
I'm not sure if i originally uploaded it as ASCII. However, i just reuploaded it, and before i did, i used the "convert to ASCII" tool in bbedit.
Is this the right thng to do?
No, not change it to ASCII in an editor, leave it as it is.
When uploading files with FTP program (Filezilla, CuteFTP, WS_FTP or whatever) make sure the FTP program uploads them as ASCII and not as Binary files.
Usually you can set this manually or let the FTP-prog detect the right format with "auto".
Control if .php files are uploaded as "ASCII".
KArin
rtsnoz
01-14-2007, 05:50 AM
Hmmm. I have tried this. The setting was already on Auto, however, i switched this setting to ASCII and reuploaded a new index.php again. It still doesn't work.
Thanks for you help and patience!
Rohan
austriaka
01-14-2007, 07:09 AM
The only way is to download a fresh PP package and upload all files to your account.
If the problem still is there, please ask your hoster, perhaps they have something in their settings what creates empty lines in beginnig of your source code.
If it is working with the fresh installation, try upload every addon one by one with always testing the rss before installing a new one. Then you should see, if an addon is the reason for the issue.
If anything is working fine with all the addons, then make your "small easy alterations for URI stuff".
If these alterations are the reason for the error, it would be helpful if you would post them here so we can check them.
KArin
rtsnoz
01-15-2007, 11:41 AM
The URI stuff is pretty simple and is outlined by Justin Blanton - clever guy..
http://justinblanton.com/2006/08/some-simple-changes-ive-made-to-pixelpost
Originally i didn't think this would be causing the problem... maybe it could be?
austriaka
01-15-2007, 01:24 PM
Did you also perform that?
Putting HTML back into the RSS feed
I’m not quite sure why, but Pixelpost removes all traces of HTML from the RSS feed. This was unacceptable as I link a lot and hated the fact that if someone wanted to follow the link they’d have to go to the image’s page and click on the “info+comments” link where they could then click on the link they wanted. Nevermind the fact that they likely wouldn’t know it was a link in the first place.
In any event, the fix is about as simple as they come. All you need to do is comment out a single line, somewhere around line 800:
$body = strip_tags( $body );
That’s it. The feed should still validate just fine.
Text within the labels of a feed is [CDATA] what means no HTML Tags should be there.
Remove the comment Justin suggested and try to validate again.
KArin
rtsnoz
01-16-2007, 02:47 AM
no. haven't done that.... just the URI stuff...
austriaka
01-16-2007, 07:26 AM
Did you do this?
For example, to get your RSS feed to link to your posts using the new URI structure, you’ll need to modify the link element of the feed.
What did you write in your .htaccess? How is the rss supposed to be called?
KArin
rtsnoz
01-16-2007, 10:34 AM
problems sorted... thanks alot for everybodys help. I ended up talking to a software enginer friend of mine... VERY smart dude: http://valorin.net
have a look: feed://www.rohanthomson.com/photos/rss
According to valorin:
For an RSS feed to work, it requires a few things. 1) Header information to be sent to the browser, and 2) <?xml to be at the VERY START of the file.
This was not happening because *something* was outputting data BEFORE the script sent the header and text for the RSS. Therefore the browser received a few blank lines of information before the RSS essential first information.
This caused the RSS feed to not be valid, and not work as wanted.
Now, on the end of the includes/pixelpost.php file was a few blank lines. Since this file was included into the script BEFORE the RSS was generated, these blank lines were sent to the browser.
Since fixing the RSS feed. i've also applied my URI stuff to it so that the link is simply /rss...
Thanks again for everybodys help. Appreciated!
austriaka
01-16-2007, 02:42 PM
Now, on the end of the includes/pixelpost.php file was a few blank lines. Since this file was included into the script BEFORE the RSS was generated, these blank lines were sent to the browser.
Ok, so I wasn't completely wrong in the beginning... The problem was done by the empty lines and the empty lines come from uploading a php file not as ASCII. In original PP/includes/pixelpost.php there are no empty lines...
But I'm happy everything is working now for you!
KArin
vBulletin® v3.7.3, Copyright ©2000-2013, Jelsoft Enterprises Ltd.