As we near our opening, we realized we almost overlooked an important aspect on our website: an RSS feed. This blog has it’s own feed, but the BIOS_LEVEL main page has no feed of its own. While I was looking over this, many important questions arose:
- How many items should we display?
- Should we include articles and news, or a separate feed for each?
- Should we allow links and images in the feed?
Luckily, it didn’t take long to decide on what to and what not to include. The final product gathers the latest product reviews and news feed. It orders them in time of posting, so everything is always up to date. This is not only great for us, but also for the sites that we feature in our news feed.
The only issue I ran in to was the merging of several database tables into one. Rather than query to MySQL database twice: once for reviews, and once for news, I chose to make a single query using the UNION term. It merges two queries that have an equal number of columns into a single table, where I can sort the entries as I please. The final product looked like something as below. Slightly complicated to read, but oh so fantastic in usage!
$query = "SELECT title,shortdesc,'a' AS type,UNIX_TIMESTAMP(id) FROM articles LIMIT 3 UNION SELECT t.topic_title AS title,p.post_text AS shortdesc,'n' AS type,t.topic_id AS id FROM phpbb_topics t,phpbb_posts_text p,phpbb_users u WHERE t.forum_id = 10 AND u.user_id = t.topic_poster AND t.topic_first_post_id = p.post_id LIMIT 7";
Oh, and you can’t subscribe to it yet. We’re putting it under feedburner in the morning.