Page 1 of 1
comments AND trackbacks via rss-feed?
Posted: Sat Jul 22, 2006 4:21 pm
by stm999999999
Hello,
with .../feeds/comments.rss2 (and {$serendipityBaseURL}rss.php?version=2.0&type=comments&cid={$entry.id} for single entries) you can read the comments of a blog via rss-feed.
Is it possible to get trackbacks into this feed? I think trackbacks are a special kind of comments, so they should be readable by the feed, too.
Posted: Sat Jul 22, 2006 11:41 pm
by stm999999999
Ok, I used the day to explore the rss-s9y-code.
Now, I have coded new code for this request:
(My) s9y can export in the rss-feed now:
only the comments
only the trackbacks
both
by "rss.php?version=2.0&type=comments", "rss.php?version=2.0&type=trackbacks", "rss.php?version=2.0&type=comments_and_trackbacks"
You can see it in action at
http://blog.stephan.manske-net.de/archi ... stand.html
and all these for the whole blog or for single articels.
I thougt my code is clean, where or how can I submit them to s9y?
Posted: Mon Jul 24, 2006 12:00 pm
by garvinhicking
Hi!
Please post your patch here, you could psate it into
http://nopaste.php-q.net/ for example.
Best regards,
Garvin
Posted: Mon Jul 24, 2006 6:09 pm
by stm999999999
Posted: Mon Jul 24, 2006 10:19 pm
by stm999999999
There are two things more:
1) In the syndication-plugin:
for the "RSS 2.0 Kommentar" from
to
Code: Select all
/feeds/comments_and_trackbacks.rss2
or: let the use config whether only comments or both.
But I think, both should be default for most users. I do not know why someone could whish to feed only the comments.
2) for the feed-templates:
in every feed-template replace
Code: Select all
wfw:commentRss>{$serendipityBaseURL}rss.php?version={$metadata.version}&type=comments&cid={$entry.feed_id}</wfw:commentRss>
with
Code: Select all
<wfw:commentRss>{$serendipityBaseURL}rss.php?version={$metadata.version}&type=comments_and_trackbacks&cid={$entry.feed_id}</wfw:commentRss>
It would be the best, if every template-writer would make these changes, but as I see, the most templates do not have their own feed-tpl's, so it would be enough to make the change in the default-theme.
Posted: Tue Jul 25, 2006 11:42 am
by garvinhicking
Hi!
You should really make yourself familiar with GNU Diff! Your changes were a pain in the behind to incorporate.
I changed it a bit, and the outcome is this:
http://svn.berlios.de/viewcvs/serendipi ... v&rev=1339
IMHO changing the default comment feed to include trackbacks is not so good. Trackbacks much more often contain spam, and IMHO it shouldn't trigger the RSS feed anytime. If people want to subscribe to that, they should IMHO do so explicitly? A patch to the syndication plugin should be made for this, I think.
Best regards and thanks for your work,
Garvin
Posted: Thu Jul 27, 2006 10:07 pm
by stm999999999
You should really make yourself familiar with GNU Diff! Your changes were a pain in the behind to incorporate.

I should - when I have the time
But, in what way is it possible to make comments to the change, when using diff?
IMHO changing the default comment feed to include trackbacks is not so good. Trackbacks much more often contain spam, and IMHO it shouldn't trigger the RSS feed anytime.
Did it? OK, it is not my expirience, but if you say so ... yeah, these should not blown out in the world be RSS.
If people want to subscribe to that, they should IMHO do so explicitly? A patch to the syndication plugin should be made for this, I think.
If I found the time ... I think there should be three possible feed-options, so the admin can show one, two or three feeds in the sidebar.
Best regards and thanks for your work,
it was my pleasure!
Posted: Sat Jul 29, 2006 12:38 am
by stm999999999
Now I take another look at your code, and there is something I would do in a slight different way.
Your Code:
Code: Select all
function serendipity_fetchComments($id, $limit = null, $order = '', $showAll = false, $type = 'NORMAL') {
if ($type == 'comments') {
$type = 'NORMAL';
} elseif ($type == 'trackbacks') {
$type = 'TRACKBACK';
} elseif ($type == 'comments_and_trackbacks') {
$type = '%';
}
IMHO it is a little bit dangerous, because you use a variable you get from the calling function ($type) in some cases directly for the sql-statement:
If the calling function makes $type neither "comments", "trackback" nor "comments_and_trackbacks", then your if-construct will pass trough these wrong value!
I would prefer a) to take a different variable for the sql-statement and b) to make sure that only the three wanted values for the sql-statement can pass through:
Code: Select all
function serendipity_fetchComments($id, $limit = null, $order = '', $showAll = false, $commentType = 'comments') {
switch ($commentType) {
case 'comments_and_trackbacks':
$type = '%';
break;
case 'trackbacks':
$type = 'TRACKBACK';
break;
case 'comments':
default:
$type = 'NORMAL';
break;
}
Or if you like "if" more:
Code: Select all
if ($commentType == 'comments_and_trackbacks') {
$type = '%';
} elseif ($commentType == 'trackbacks') {
$type = 'TRACKBACK';
} else {
$type = 'NORMAL';
}
Posted: Mon Jul 31, 2006 1:07 pm
by garvinhicking
Hi!
I understand your reasoning of the $type change, but I prefer to keep it in a BC way. I don't like changing function call parameters, so when adding new functionality, I would add that switch to the new input, and not change the old input/output...
IMHO in the end though, it boils down to the same SQL code: Users can put both "NORMAL" and "TRACKBACK" to the function, as well as "comments" and "trackbacks".
Thanks a lot,
Garvin