boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Adding Comments to RSS2 Feeds

 
Post new topic   Reply to topic    boardom Forum Index -> How to ?
View previous topic :: View next topic  
Author Message
flickerfly



Joined: 06 May 2003
Posts: 49

PostPosted: Wed May 28, 2003 8:23 pm    Post subject: Adding Comments to RSS2 Feeds Reply with quote

I have tweaked AmphetaDesk to read comments and so I wanted it to work in my blog. I think this is only for RSS2 so save the following to b2rss2.php or just add <comments><![CDATA[http://josiah.ritchietribe.net/b2/<?php comments_link() ?>]]></comments>.

NOTE: Change my blogs URL to yours. I couldn't find a way to pull that out of b2 automatically so you'll need to edit that piece by hand but that is a one time deal. If you know how, I'd gladly change what I have here and on my own site.

Here's the template I use to do it:
Code:
<?php /* These first lines are the first part of a CafeLog template.
         In every template you do, you got to copy them before the CafeLog 'loop' */
$blog=1; // enter your blog's ID
header("Content-type: text/xml");
include ("blog.header.php");
if (!isset($rss_language)) { $rss_language = 'en'; }
if (!isset($rss_encoded_html)) { $rss_encoded_html = 0; }
if (!isset($rss_excerpt_length) || ($rss_encoded_html == 1)) { $rss_excerpt_length = 0; }
?><?php echo "<?xml version=\"1.0\"?".">\n"; ?>
<!-- generator="b2/<?php echo $b2_version ?>" -->
<rss version="2.0"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
   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/">

<channel>
   <title><?php bloginfo_rss("name") ?></title>
   <link><?php bloginfo_rss("url") ?></link>
   <description><?php bloginfo_rss("description") ?></description>
   <dc:language><?php echo $rss_language ?></dc:language>
   <dc:creator><?php echo $admin_email ?></dc:creator>
   <dc:rights>Copyright <?php echo mysql2date('Y', get_lastpostdate()); ?></dc:rights>
   <dc:date><?php echo gmdate('Y-m-d\TH:i:s'); ?></dc:date>
   <admin:generatorAgent rdf:resource="http://cafelog.com/?v=<?php echo $b2_version ?>"/>
   <admin:errorReportsTo rdf:resource="mailto:<?php echo $admin_email ?>"/>
   <sy:updatePeriod>hourly</sy:updatePeriod>
   <sy:updateFrequency>1</sy:updateFrequency>
   <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>

   <?php $items_count = 0; while($row = mysql_fetch_object($result)) { start_b2(); ?>
   <item>
      <title><?php the_title_rss() ?></title>
      <link><![CDATA[<?php permalink_single_rss() ?>]]></link>
      <dc:date><?php the_time('Y-m-d\TH:i:s'); ?></dc:date>
      <dc:creator><?php the_author() ?> (mailto:<?php the_author_email() ?>)</dc:creator>
      <dc:subject><?php the_category_rss() ?></dc:subject>
      <guid isPermaLink="false"><?php echo $id; ?>@<?php bloginfo_rss("url") ?></guid>
      <description><?php the_content_rss('', 0, '', $rss_excerpt_length, 2) ?></description>
                <comments><![CDATA[http://josiah.ritchietribe.net/b2/<?php comments_link() ?>]]></comments>
      <content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded>
   </item>
   <?php } ?>

</channel>
</rss>


Last edited by flickerfly on Wed May 28, 2003 9:21 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
flickerfly



Joined: 06 May 2003
Posts: 49

PostPosted: Wed May 28, 2003 9:20 pm    Post subject: Reply with quote

I thought this was working, but I was wrong. It's trying to go to http://josiah.ritchietribe.net/b2/b2rss2.php?p=121&c=1#comments instead of http://josiah.ritchietribe.net/b2/index.php?p=121&c=1#comments. Anyone know what I messed up? I'd like to get this working. It's just a matter of building the correct URL.

I could use <?php bloginfo(url) ?> for the url, but that ends the url with index.php. Can I add the "?p=#&c=$#comments" part with other tags and piece it together?

Any reason "<?php bloginfo(url) ?>?p=<?php permalink_anchor(id) ?>&c=1#comments" wouldn't work? Nope, that's outputs "http://josiah.ritchietribe.net/b2/index.php?p=<a name="124"></a>&c=1#comments". Closer though.

Help??
Back to top
View user's profile Send private message Visit poster's website
flickerfly



Joined: 06 May 2003
Posts: 49

PostPosted: Thu May 29, 2003 1:34 pm    Post subject: Reply with quote

BINGO!!!

<comments><![CDATA[<?php bloginfo(url) ?>?p=<?php the_ID() ?>&c=1#comments]]></comments>
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> How to ? All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group