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?
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
April 04, 2011 3:22pm
Subscribe [3]#1 / Apr 04, 2011 3:22pm
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
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
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
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
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
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
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
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
I’m validating [removed] at http://validator.w3.org/feed
#10 / Apr 06, 2011 7:12pm
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
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
My pleasure, svh1! If anything else comes up, please start a new thread. =)