I'm kind of new to rss feeds, but I'm able to create a feed dynamically using PHP and it works great. My problem is that occasionally the feed doesn't have any items (I limit the age of feed items to 60 days, and sometimes nothing has happened in that time).
What I would expect to happen is that I just simply wouldn't have any <item>
s in my xml page. However, when I do it that way, the feed reader (at least the Google one) seems to be a little borked. Even though the XML contains the name of the feed properly still, it shows up without a title.
The only way I've found so far to fix this is to put a dummy item in, that is simply <item><title></title></item>
. Then my Google reader finds the name of the feed properly, and it just looks like a blank feed.
It seems that is a hokey solution that is likely incorrect.
Is there some standard way to deal with the XML presentation for an empty feed?
Edit: Here's what the empty feed looks like
<?xml version="1.0" encoding="utf-8"?> <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>News at Example</title> <link>http://www.example.com/feed/sample-reviews</link> <description>Latest Additions to the Sample Category</description> <dc:language>en-us</dc:language> <dc:creator>Contact Example through our "contact us" page</dc:creator> <dc:rights>Copyright 2010 Example Technologies Inc.</dc:rights> <admin:generatorAgent rdf:resource="http://www.codeigniter.com/" /> <item><title></title></item> </channel></rss>
<item>
less feed. – bobince