Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+6 votes
1.1k views
in Q2A Core by
Hi Gideon and QA friends,

Following our private emails with Gideon, I would like to contribute a tiny piece of code which creates an RSS feed with QA topics.

I have basic PHP scripting knowledge, so be gentle with me :) This is a very quick-and-dirty solution to cover my basic RSS requirement for a support tool like QA. I have some vars floating around which surely exist somewhere in the QA code itself.

My solution is based on a free PHP/RSS library found here: http://www.ajaxray.com/blog/2008/03/08/php-universal-feed-generator-supports-rss-10-rss-20-and-atom/

The files are available here:  http://smslib.org/qa/rss.zip

All files are supposed to reside in the QA directory. The rss.php implements the RSS feed, based on QA topics.

Hopefully, a similar module will eventually be included in base QA.

Best Regards, Thanasis.
by
Wow - thanks for this!
by
awesome, thanks for sharing with everyone!

2 Answers

0 votes
by
thanks a lot!
I suppose you need to edit the html header to include the feed link. Can you document that?
by
Hi guys,

What you should add in the "Admin -> Layout -> Custom Tags in HEAD section" is something like the following:

<link rel="alternate" type="application/rss+xml" title="SMSLib Q&A - Questions" href="http://example.com/qa/script.php" />
<link rel="alternate" type="application/rss+xml" title="SMSLib Q&A - All Posts" href="http://example.com/qa/script.php?all=1" />

I modified the initial script and now I use two feeds, one with only questions and one full.

Here is the new script: http://pastebin.com/3pgceAci

If you call it with no parameters, you'll get a Questions feed. If you call it with "all=1" you get a full feed (questions, answers, comments).

I don't use the script directly - I cache its output to static xml files and publish the static files.

--EDIT:

Forgot to say that everything in the script in-between the lines "***CHANGE***" need to be changed to your URLs.
by
great thanks!
by
in the second CHANGE section I needed to fix $postid + 1 to $postId (capital _I_ and without +1) - otherwise the links where all broken.

But now it works great, thanks a lot!
0 votes
by
Really like this, thanks!

I would like to see an option where I can get the title of the each question, two lines of content of the question in the feed as well. And then the title clickable.

Any idea how to do this?
...