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.

Create RSS feed from non EE tables

April 04, 2011 3:22pm

Subscribe [3]
  • #1 / Apr 04, 2011 3:22pm

    APGWest

    295 posts

    Does anyone have any info on how I could create a RSS feed from tables within my EE site that aren’t part of weblogs, articles, etc?

  • #2 / Apr 05, 2011 6:40am

    John Henry Donovan

    12339 posts

    svh1,

    You could use the Query Module to return data from the database and use the provided RSS template as a loose structure for it. Replace the weblog:entries tag with your query module tags

    Does that help?

  • #3 / Apr 05, 2011 12:49pm

    APGWest

    295 posts

    Weird, I tried exactly that yesterday before posting here and was getting all kinds of errors.  Now I try it and it works.  I’ll blame it on it being a Monday.  Thanks, John!

  • #4 / Apr 05, 2011 1:13pm

    APGWest

    295 posts

    Well, it’s working but it won’t validate, saying I’m missing the closing channel element.  It’s certainly there but I wonder if the closing {/exp:query} tag is snagging something?

  • #5 / Apr 06, 2011 2:46pm

    APGWest

    295 posts

    Anyone else run into this?  Again, it works but it doesn’t validate which can be a pain if you’re dealing with vendors that will only accept validated feeds (as they should).

  • #6 / Apr 06, 2011 5:55pm

    Sue Crocker

    26054 posts

    Hi, svh1. It’s hard to tell what you’re seeing without a link and without a clear understanding what kind of content you’re trying to use.

  • #7 / Apr 06, 2011 6:48pm

    APGWest

    295 posts

    You mean you can’t see my code through my eyes?!?! 😉  That was incredibly dumb of me not to post something for you to go off of huh?

    {assign_variable:master_weblog_name="articles"}
    {exp:rss:feed weblog="{master_weblog_name}"}
    
    <?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>
        
        <title>{exp:xml_encode}Top Jobs{/exp:xml_encode}</title>
        <description>See the top job listings in the Skagit Valley Herald</description>
        <dc:language>en</dc:language>
        <dc:creator></dc:creator>
        <dc:rights>Copyright {gmt_date format="%Y"}</dc:rights>
        <dc:date>{gmt_entry_date format="%Y-%m-%dT%H:%i:%s-08:00"}</dc:date>
        <admin:generatorAgent rdf:resource="http://expressionengine.com/" >
        
        {exp:query sql="SELECT ad_number,ad_text,insert_datetime FROM topjobs"}
        <item>
          <title>{exp:xml_encode}{exp:char_limit total="50"}{ad_text}{/exp:char_limit}{/exp:xml_encode}</title>
          <link>http://www.goskagit.com/classifieds/topjobs/</link>
          <guid>http://www.goskagit.com/classifieds/topjobs/{ad_number}/#When:{gmt_entry_date format="%H:%i:%sZ-08:00"}</guid>
          <description>{exp:xml_encode}{ad_text}{/exp:xml_encode}</description>
          <dc:date>{gmt_entry_date format="%Y-%m-%dT%H:%i:%s-08:00"}</dc:date>
        </item>
        {/exp:query}
        
        </channel>
    
    </rss>
    
    {/exp:rss:feed}
  • #8 / Apr 06, 2011 7:03pm

    Lisa Wess

    20502 posts

    Do you have a link to the validator output for this RSS feed, with source shown, that we can see? It’s hard to reproduce on our own installs since we don’t have your extra tables.

    Thanks!

  • #9 / Apr 06, 2011 7:08pm

    APGWest

    295 posts

    I’m validating [removed] at http://validator.w3.org/feed

  • #10 / Apr 06, 2011 7:12pm

    Lisa Wess

    20502 posts

    The error I’m seeing is:

    This feed does not validate.
    line 93, column 4: Missing channel element: link [help]
        </channel>

    and this is what help had to say.  It appears you need to have a link element for your actual channel tag which points to the homepage of your site.  I don’t see that in your code actually.

    I hope that helps!

  • #11 / Apr 06, 2011 7:19pm

    APGWest

    295 posts

    That did the trick.  I did not see in the help that I needed to do that.  Fresh eyes and all I suppose…  Thanks!

  • #12 / Apr 06, 2011 7:22pm

    Lisa Wess

    20502 posts

    My pleasure, svh1!  If anything else comes up, please start a new thread.  =)

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

ExpressionEngine News!

#eecms, #events, #releases