ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

RSS feed for comments

July 09, 2008 4:40pm

Subscribe [4]
  • #1 / Jul 09, 2008 4:40pm

    scottystang

    106 posts

    Quick question about RSS feeds.  I want to create an RSS feed that users can subscribe to for new comments that are left on any of my weblog entries.  Is this a native EE feature or do I have to write the RSS feed myself?

    Basically, I want to pull new comments using a feed reader instead of logging into EE each day and looking for new comments in the Edit tab.

    Thanks!

  • #2 / Jul 09, 2008 4:56pm

    Ingmar

    29245 posts

    You’ll need to come up with a template of your own, but it can certainly be done. I have used this on occasion, might get yuo started:

    <?php header('Content-type: application/rss+xml; charset=utf-8'); ?>
    
    {exp:rss:feed status="open" weblog="my_weblog"}
    <?xml version="1.0" encoding="{encoding}"?>
    <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>
            {exp:comment:entries limit="1"}
                <title>{weblog_name} | {title} | comments</title>
                <link>{comment_entry_id_auto_path}</link>
            {/exp:comment:entries}
        <description>{weblog_description}</description>
        <dc:language>{weblog_language}</dc:language>
        <dc:creator>{email}</dc:creator>
        <dc:rights>Copyright {gmt_date format="%Y"} by the respective commenters</dc:rights>
        <dc:date>{gmt_date format="%Y-%m-%dT%H:%i:%s%Q"}</dc:date>
        <admin:generatorAgent rdf:resource="http://www.expressionengine.com/" >
    
    {exp:comment:entries}
      {if comments}
        <item>
          <title>{exp:xml_encode}{title} | Comment by {name}{/exp:xml_encode}</title>
          <link>{comment_entry_id_auto_path}#{comment_id}</link>
          <description>{exp:xml_encode}Comment by {name}{/exp:xml_encode}</description>
          <content:encoded><![CDATA[{comment}(Commented by <a href="http://{url}">{name}</a>
     on {comment_date format='%m/%d/%Y'} at {comment_date format='%h:%i %a'})]]></content:encoded>
          <dc:date>{comment_date format="%Y-%m-%dT%H:%i:%s%Q"}</dc:date>
        </item>
      {/if}
    {/exp:comment:entries}
        </channel>
    </rss>
    {/exp:rss:feed}

    Making sense?

  • #3 / Jul 09, 2008 5:05pm

    scottystang

    106 posts

    Awesome, thanks.  I’ll start with that and update to fit my needs.  Thanks!

  • #4 / Jul 14, 2008 2:42pm

    Crssp-ee

    572 posts

    Hi, hey jumping in here, trying to get a comment rss feed up and running.
    I copied Ingmar’s code from above, changed the “my_weblog” to the actual name of my blog.
    Then set under template preferences for type of template “RSS page” now I get this error:

    XML Parsing Error: XML or text declaration not at start of entity
    Location: <a href="http://daily.crssp.com/index.php?/ee-code/all_comments_rss/">http://daily.crssp.com/index.php?/ee-code/all_comments_rss/</a>
    Line Number 3, Column 1:<?xml version="1.0" encoding="utf-8"?>
    ^


    Any ideas why?
    Do I need to install an XML encode plugin, I spotted this in another forum help thread?
    Nope not it, it was installed by default, checked via ftp, didn’t know why that one wouldn’t of been installed.
    hmmm…

  • #5 / Jul 14, 2008 2:50pm

    Ingmar

    29245 posts

    Get rid of the PHP, especially if you haven’t turned it on 😊 I think my example stems from a time when EE didn’t support RSS pages as such, but you probably don’t need it now at all.

  • #6 / Jul 14, 2008 2:55pm

    Crssp-ee

    572 posts

    Cool… I removed all of the first line then:

    <?php header('Content-type: application/rss+xml; charset=utf-8'); ?>

    It’s sort of working but not quite:
    http://daily.crssp.com/index.php?/ee-code/all_comments_rss/
    I’m trying to pull the feeds from a template group fresh, fresh-zine the name of the weblog.
    It’s not pulling in the only actual comment I have added, any ideas what else is amiss then?
    tnx

    The actual Salmon templates are looking for the feed here:
    http://daily.crssp.com/index.php?/fresh/comment_rss/youloveus_daily_site_sotd/
    But I didn’t have a comment_rss.tpl to upload, and no idea what it consists of, getting close though maybe.
    Thanks Ingmar.

  • #7 / Jul 14, 2008 3:00pm

    Ingmar

    29245 posts

    As with all comments, this needs to go on a single entry page. This feed will only show comments to one particular entry, so you need to provide that info in the URL. This seems to work fine:

    http://daily.crssp.com/index.php?/ee-code/all_comments_rss/youloveus_daily_site_sotd/

  • #8 / Jul 14, 2008 3:02pm

    Crssp-ee

    572 posts

    It’s not showing the actual comment text blurb I had filled in though which was:
    “Commenting this post Daily SOTD 1 subscribe to feed. “
    probably something else that needs added then?
    Close but no cigar, i get that alot, lol.
    thanks.

  • #9 / Jul 14, 2008 3:03pm

    Ingmar

    29245 posts

    If you were looking for a list / feed of all comments, this page should get you started.

  • #10 / Jul 14, 2008 3:04pm

    Crssp-ee

    572 posts

    Cool thanks Ingmar, a list to all feeds would be just great, I wasn’t able to find an adequate version.
    I’ll check it later then. 😊
    If you search RSS or Feed you won’t find the page Ingmar just linked in the docs, makes things tough for newbies.
    It’s always best to get the straight link to the good stuff though, thanks again Ingmar!

  • #11 / Jul 14, 2008 3:10pm

    Ingmar

    29245 posts

    It’s not showing the actual comment text blurb I had filled in though

    Yes it does:

    <item>
          <title>YouLove.us -Daily Site SOTD | Comment by daily.Planet</title>
          <link>http://daily.crssp.com/index.php?4/#2</link>
          <description>Comment by daily.Planet</description>
          <content:encoded><![CDATA[Commenting this post Daily SOTD 1 subscribe to feed.
    (Commented by <a href="http://">daily.Planet</a>
     on 07/14/2008 at 12:32 pm)]]></content:encoded>
          <dc:date>2008-07-14T12:32:57-05:00</dc:date>
        </item>

    This is straight from your site.

  • #12 / Jul 14, 2008 3:25pm

    Crssp-ee

    572 posts

    Looks nice now Ingmar, pasted in the tags you linked me too earlier:
    {exp:comment:entries sort="desc" orderby="date" limit="10" dynamic="off"}

    {comment}

    By {name} on {comment_date format="%Y %m %d"}

    From the entry ‘{title}’.

    {/exp:comment:entries}
    Replacing the section at the beginning of the barebones template from above:
      <channel>
          {exp:comment:entries limit="1"}
            <title>{weblog_name} | {title} | comments</title>
            <link>{comment_entry_id_auto_path}</link>
          {/exp:comment:entries}

    If I’m on the right track now, then I can rename the templates to those that the Salmon templates are looking for and be all set.
    Thanks again, case closed for now. 😊

  • #13 / Jul 17, 2008 4:48pm

    usclib

    6 posts

  • #14 / Jul 17, 2008 6:03pm

    Crssp-ee

    572 posts

    Thanks alot, it seems like everything’s easy to find till you need it.
    Thanks again.

    A-hhh-ee-aaaa, much more like it copy-paste, rock and roll.
    The earlier efforts the actual comment was there but not showing in the feed readers, probably something to do with the encoding or cdata, who knows this works perfectly fine:
    Demo Wiki Version Sample all posts for default_site

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases