|
|
BOARDS
Announcement
I had to clean the boards due to massive spam. Actually i deleted everything /-one after 1st Oct 2008. It was the only way to get this spam out of the boards. So i'm sorry for all serious users who registered/posted meanwhile.
- Columba livia
- New member
- Registered: 03-07-2006
- Posts: 1
RSS Error
Ay, I've just installed MyNews on my website, but the RSS seems to come up with an error when I try to view it:
Anything I can do about that?
The link is: www.birdorgod.org/news/rss.php
Thanks for any help, Columba livia
- admin
- Administrator
- From: Winterhur, Zurich, Switzerland
- Registered: 25-11-2004
- Posts: 462
- Website
- sidtheduck
- Moderator
- From: down by the water
- Registered: 14-07-2006
- Posts: 515
- Website
Re: RSS Error
I had some problems with my RSS working in conjunction with my Yahoo Widgets Engine rss feed reader widget (I think it had to do with the Yahoo Widget engine reading only RSS 2.0). Anyway, I rewrote the rss.php file for RSS 2.0 (to the best of my ability and it passed RSS 2.0 validation). If anyone else would like to use it, I've pasted it below. You still have to call the rss feed as 'your_site/rss.php?mndo=rss'. Hope it helps.
EDIT: See my post below for the correct scripting. (I had a couple of small bugs / errors, but it works now).
EDIT: edited out wrong code
btw, AWESOME news script!! It works wonders!!
Last edited by sidtheduck (19-07-2006 18:34:16)
If it looks like a duck, and quacks like a duck, we have at least to consider the possibility that we have a small aquatic bird of the family anatidae on our hands. ~Douglas Adams~
- sidtheduck
- Moderator
- From: down by the water
- Registered: 14-07-2006
- Posts: 515
- Website
Re: RSS Error
The "code" tags were adding some extra weird HTML characters and semicolons, so I pasted it below. Let me know if this isn't kosher and I will remove it.
Thanks.
EDIT: See my post below for the correct scripting. (I had a couple of small bugs / errors, but it works now).
EDIT: edited out wrong code
Last edited by sidtheduck (19-07-2006 18:33:47)
If it looks like a duck, and quacks like a duck, we have at least to consider the possibility that we have a small aquatic bird of the family anatidae on our hands. ~Douglas Adams~
- Denny
- Member
- Registered: 11-02-2006
- Posts: 11
Re: RSS Error
Hallo ich habe den Quelltext geändert um .../rss.php direkt und ohne .../rss.php?mndo=rss aufzurufen ! es klappt wunderbar. Änderungen im xml header !! <? // send xml header header('Content-Type: text/xml; charset=ISO-8859-1'); echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"; echo "<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:admin=\"http://webns.net/mvcb/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\">"; error_reporting(0);
$dir=substr(__FILE__, 0, strrpos(__FILE__, "/")+1);
// load config include_once($dir."config.inc.php");
?> <channel> <title><?=htmlspecialchars($rssTitle)?></title> <link><?=$rssChannelUrl?></link> <description><?=htmlspecialchars($rssDescription)?></description> <language>de</language> <author>Denny</author> <copyright>Denny Eberhardt</copyright>
<? // Constructing RSS feed
// news data $dat=$dir."data.dat"; $foo=file($dat); $stuff= new mdasort; $stuff->sortkeys = array(array('time','DESC'));
if (count($foo)==0){ $empty=true; }else{ $i=0; foreach ($foo as $line){ $line=explode("|", rtrim($line)); if ($line[2]=="static" || ($line[2]=="dynamic" && $line[1]<$now)){ $stuff->data[$i] = array("id" => $line[0], "time" => $line[1], "mode" => $line[2], "title" => $line[3], "story" => $line[4], "teaser" => $line[5]); $i++; } } if ($i>0){ $stuff->sortkeys = array(array('time','DESC')); $stuff->msort(); $numposts=count($stuff->data); }else{ $empty=true; $numposts=0; } }
$i=0; $news = array_slice ($stuff->data, 0, $rssNumNews);
// krsort($news); foreach ($news as $row){ $title = htmlspecialchars(html_entity_decode(strip_tags(stripslashes($row['title'])))); $description = htmlspecialchars(html_entity_decode(strip_tags(stripslashes($row['teaser'])))); $link = $rssNewspageUrl.((strpos($rssNewspageUrl, "?")!==false) ? "&" : "?")."mnid=".$row['id']; $i++;
echo ' <item> <title>'.$title.'</title> <link>'.$link.'</link> <description>'.$description.'</description> <pubdate>'.date('d.m.Y', $row['time']).'</pubdate> </item> ';
}
?> </channel> </rss>
Last edited by Denny (18-07-2006 17:13:29)
- sidtheduck
- Moderator
- From: down by the water
- Registered: 14-07-2006
- Posts: 515
- Website
Re: RSS Error
Denny wrote:Hallo ich habe den Quelltext geändert um .../rss.php direkt und ohne .../rss.php?mndo=rss aufzurufen ! es klappt wunderbar. Änderungen im xml header !!
English translation wrote: Hello I changed the source text around.. ./rss.php directly and without calling.. ./rss.php?mndo=rss! it works out wonderfully. Changes in the xml header!!
Denny, Please excuse my translation. It is a website translation.
The '?mndo=rss' is called to skip over the 'style' css elements in the '/forum/config.inc.html' file. It seems like your code works because the new header is calling it rss 1.0, even though it is coded as rss 2.0. So it works, but is not entirely correct and may not work will all rss feed aggregators (but it may, I am not sure).
It would still be better for you to call the rss on your site as 'http://www.tvnews-wildeck.de/Archiv2006/news/rss.php?mndo=rss' since it would skip over the css style elements for the rss page.
German translation? wrote: Denny, Bitte entschuldigen Sie meine Übersetzung. Es ist eine Website-übersetzung.
Der „?mndo=rss“ wird gerufen, das „Stil“ css Elemente in der „config.inc.php“ Akte zu überspringen. Es scheint wie Ihre Codesarbeiten, weil der neue Titel es rss 1,0 ruft, obwohl es als rss 2,0 kodiert ist. So arbeitet es, aber ist nicht völlig richtig und kann nicht Wille alle rss Futter aggregators (arbeiten aber es kann, bin ich nicht sicher).
Es wäre noch besser für Sie, den rss auf Ihrer Stelle zu rufen, als ‘http://www.tvnews-wildeck.de/Archiv2006/news/rss.php?mndo=rss’ , da es das css Stil Elemente für die rss Seite überspringen würde.
If it looks like a duck, and quacks like a duck, we have at least to consider the possibility that we have a small aquatic bird of the family anatidae on our hands. ~Douglas Adams~
- skyh4wk
- Member
- Registered: 19-07-2006
- Posts: 12
Re: RSS Error
hi sidtheduck!
i have past your code in rss.php file of my_news script... but when i visit the page i have this error:
Parse error: parse error, unexpected T_STRING in /web/htdocs/www.e-torricelli.it/home/notizie/rss.php on line 8
do you know the reason??
i want to do a thing like this: http://www.tvnews-wildeck.de/Archiv2006 … p?mndo=rss
whit ?mndo=rss or without ?mndo=rss in the URL
thanks for the help you will give me! ;D
Last edited by skyh4wk (19-07-2006 16:13:28)
- sidtheduck
- Moderator
- From: down by the water
- Registered: 14-07-2006
- Posts: 515
- Website
Re: RSS Error
skyh4wk wrote:hi sidtheduck!
i have past your code in rss.php file of my_news script... but when i visit the page i have this error:
Parse error: parse error, unexpected T_STRING in /web/htdocs/www.e-torricelli.it/home/notizie/rss.php on line 8
do you know the reason??
i want to do a thing like this: http://www.tvnews-wildeck.de/Archiv2006 … p?mndo=rss
whit ?mndo=rss or without ?mndo=rss in the URL
thanks for the help you will give me! ;D
Okay, I've fixed my '/forum/rss.html' file and it passed 3 different validators (W3C feed validator for RSS and Atom, Userland RSS validator, and Feed validator for RSS and Atom), so I think it's finalized now. The code is below in my next post. You still have to call it with the '?mndo=rss' and it should work great!
I had a small error with the encoding (fixed on line 4 of the code below with 'encoding=\"ISO-8859-1\" ') and a very slight misuse of the '<link>' tag which is replaced with the '<guid>' tag as shown below on line 61.
Let me know if you have any other problems. Thanks!
If it looks like a duck, and quacks like a duck, we have at least to consider the possibility that we have a small aquatic bird of the family anatidae on our hands. ~Douglas Adams~
- sidtheduck
- Moderator
- From: down by the water
- Registered: 14-07-2006
- Posts: 515
- Website
Re: RSS Error
EDIT: Edited to render correctly on these forums. Just cut and paste the text below and it should work well.
<? // send xml header header('Content-Type: text/xml; charset=UTF-8'); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; echo "<rss version=\"2.0\">"; error_reporting(0);
$dir = substr(__FILE__, 0, strrpos(__FILE__, "/")+1);
// load config include_once($dir."config.inc.php");
?>
<channel> <title><?=htmlspecialchars($rssTitle)?></title> <ttl>60</ttl> <link><?=$rssChannelUrl?></link> <description><?= htmlspecialchars($rssDescription)?></description> <language>en-us</language> <lastBuildDate><?= date('r', filemtime($dir.'data.dat'))?></lastBuildDate> <? // Constructing RSS feed
// news data $dat = $dir."data.dat"; $foo = file($dat); $stuff = new mdasort; $stuff->sortkeys = array(array('time', $rssOrder));
if (count($foo) == 0){ $empty = true; }else{ $i = 0; foreach ($foo as $line){ $line = explode("|", rtrim($line)); if ($line[2] == "static" || ($line[2] == "dynamic" && $line[1]<$now)){ $stuff->data[$i] = array("id" => $line[0], "time" => $line[1], "mode" => $line[2], "title" => $line[3], "story" => $line[4], "teaser" => $line[5]); $i++; } } if ($i>0){ $stuff->msort(); $numposts = count($stuff->data); }else{ $empty = true; $numposts = 0; } }
$i=0; $news = array_slice ($stuff->data, 0, $rssNumNews);
foreach ($news as $row){ $title = htmlspecialchars(html_entity_decode(strip_tags(stripslashes($row['title'])))); $description = htmlspecialchars(html_entity_decode(strip_tags(stripslashes($row['teaser'])))) ; $link = $rssNewspageUrl.((strpos($rssNewspageUrl, "?")!==false) ? "&" : "?")."mnid=".$row['id']; $i++;
echo ' <item> <title>'.$title.'</title> <link>'.$link.'</link> <description>'.$description.'</description> <pubDate>'.date("r", $row['time']).'</pubDate> <guid>'.$link.'</guid> </item> ';
} ?> </channel> </rss>
Last edited by sidtheduck (28-08-2006 17:56:31)
If it looks like a duck, and quacks like a duck, we have at least to consider the possibility that we have a small aquatic bird of the family anatidae on our hands. ~Douglas Adams~
- skyh4wk
- Member
- Registered: 19-07-2006
- Posts: 12
Re: RSS Error
thanks for the help!
but i'm sorry... i have the same problem...
Parse error: parse error, unexpected T_STRING in /web/htdocs/www.e-torricelli.it/home/notizie/rss.php on line 9
i don't know what i can do! :(
this is the link: http://www.e-torricelli.it/notizie/rss.php?mndo=rss
Last edited by skyh4wk (19-07-2006 18:59:42)
- sidtheduck
- Moderator
- From: down by the water
- Registered: 14-07-2006
- Posts: 515
- Website
Re: RSS Error
skyh4wk wrote:thanks for the help!
but i'm sorry... i have the same problem...
Parse error: parse error, unexpected T_STRING in /web/htdocs/www.e-torricelli.it/home/notizie/rss.php on line 9
i don't know what i can do! :(
this is the link: http://www.e-torricelli.it/notizie/rss.php?mndo=rss
Try this on line 9.
Change:
To this:
If that doesn't work, try this:
The last one should work as long as your '/forum/rss.html' file is in the same directory as the '/forum/config.inc.html' file.
Last edited by sidtheduck (19-07-2006 19:34:43)
If it looks like a duck, and quacks like a duck, we have at least to consider the possibility that we have a small aquatic bird of the family anatidae on our hands. ~Douglas Adams~
- skyh4wk
- Member
- Registered: 19-07-2006
- Posts: 12
Re: RSS Error
ok! the error on line 9 is correct... but now there is a new problem on line 54:
Parse error: parse error, unexpected '<' in /web/htdocs/www.e-torricelli.it/home/notizie/rss.php on line 54
sigh! =(
- skyh4wk
- Member
- Registered: 19-07-2006
- Posts: 12
Re: RSS Error
i have resolve the problem!!!
i have deleted on line 54 <br> and on line 20 i have change this:
<description><?=htmlspecialchars($rssDescription)?></description>;
with:
<description><?=htmlspecialchars($rssDescription)?> < / description > ;
this is an error of this forum!
:D
Last edited by skyh4wk (19-07-2006 19:32:05)
- sidtheduck
- Moderator
- From: down by the water
- Registered: 14-07-2006
- Posts: 515
- Website
Re: RSS Error
skyh4wk wrote:i have resolve the problem!!!
i have deleted on line 54 <br> and on line 20 i have change this:
<description><?=htmlspecialchars($rssDescription)?></description>;
with:
<description><?=htmlspecialchars($rssDescription)?> < / description > ;
this is an error of this forum!
:D
I see what happened now. The forum had another error before.
If you change '$dir=subs tr(__FILE__, 0, strrpos(__FILE__, "/")+1);'
with '$dir=substr(__FILE__, 0, strrpos(__FILE__, "/")+1);'.
Last edited by sidtheduck (19-07-2006 19:41:59)
If it looks like a duck, and quacks like a duck, we have at least to consider the possibility that we have a small aquatic bird of the family anatidae on our hands. ~Douglas Adams~
- skyh4wk
- Member
- Registered: 19-07-2006
- Posts: 12
Re: RSS Error
ok! i have seen the error! ;D
thanks lot!
the last things... you have said that the rss.php passed 3 different validators... now i am on http://feedvalidator.org/ and the check program give me this warning:
line 6, column 69: Unexpected Text [help]
<description>Liceo Evangelista Torricelli di Roma</description>;
have you before this problem??
- sidtheduck
- Moderator
- From: down by the water
- Registered: 14-07-2006
- Posts: 515
- Website
Re: RSS Error
skyh4wk wrote:ok! i have seen the error! ;D
thanks lot!
the last things... you have said that the rss.php passed 3 different validators... now i am on http://feedvalidator.org/ and the check program give me this warning:
line 6, column 69: Unexpected Text [help]
<description>Liceo Evangelista Torricelli di Roma</description>;
have you before this problem??
Again, it is a problem with the forum formatting.
Delete the ';' at the end of line 20 <description><?=htmlspecialchars($rssDescription)?></description>;
Should read as <description><?=htmlspecialchars($rssDescription)?></description>
EDIT: Remove the forum added space in the '</description>' tag above
Last edited by sidtheduck (19-07-2006 20:16:36)
If it looks like a duck, and quacks like a duck, we have at least to consider the possibility that we have a small aquatic bird of the family anatidae on our hands. ~Douglas Adams~
- skyh4wk
- Member
- Registered: 19-07-2006
- Posts: 12
Re: RSS Error
now your script is perfect! ;D
thanks lot for the help... you are a kind person!
- sidtheduck
- Moderator
- From: down by the water
- Registered: 14-07-2006
- Posts: 515
- Website
Re: RSS Error
skyh4wk wrote:now your script is perfect! ;D
thanks lot for the help... you are a kind person!
No problem, skyh4wk. Anytime! :-D
I edited my post above so that now people can just cut and paste the code. The new layout seems to show up correctly on the forum without any of the added spaces it was doing before. Hope it works for all!
Last edited by sidtheduck (19-07-2006 20:37:56)
If it looks like a duck, and quacks like a duck, we have at least to consider the possibility that we have a small aquatic bird of the family anatidae on our hands. ~Douglas Adams~
|
|