Fix to handle no (matching) posts found.

http://sourceforge.net/tracker/index.php?func=detail&aid=809176&group_id=51422&atid=463233


git-svn-id: http://svn.automattic.com/wordpress/trunk@375 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
mikelittle 2003-09-21 23:06:53 +00:00
parent fab908ad08
commit 23df03928d
3 changed files with 8 additions and 13 deletions

View File

@ -51,9 +51,7 @@ if (!isset($rss_language)) { $rss_language = 'en'; }
xmlns:admin="http://webns.net/mvcb/" xmlns:admin="http://webns.net/mvcb/"
xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
> >
<channel rdf:about="<?php bloginfo_rss("url") ?>"> <channel rdf:about="<?php bloginfo_rss("url") ?>">
<title><?php bloginfo_rss('name') ?></title> <title><?php bloginfo_rss('name') ?></title>
<link><?php bloginfo_rss('url') ?></link> <link><?php bloginfo_rss('url') ?></link>
<description><?php bloginfo_rss('description') ?></description> <description><?php bloginfo_rss('description') ?></description>
@ -65,17 +63,15 @@ if (!isset($rss_language)) { $rss_language = 'en'; }
<sy:updatePeriod>hourly</sy:updatePeriod> <sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency> <sy:updateFrequency>1</sy:updateFrequency>
<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase> <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
<items> <items>
<rdf:Seq> <rdf:Seq>
<?php $items_count = 0; foreach ($posts as $post) { start_b2(); ?> <?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_b2(); ?>
<rdf:li rdf:resource="<?php permalink_single_rss() ?>"/> <rdf:li rdf:resource="<?php permalink_single_rss() ?>"/>
<?php $b2_items[] = $row; $items_count++; if (($items_count == $posts_per_rss) && empty($m)) { break; } } ?> <?php $b2_items[] = $row; $items_count++; if (($items_count == $posts_per_rss) && empty($m)) { break; } } } ?>
</rdf:Seq> </rdf:Seq>
</items> </items>
</channel> </channel>
<?php if ($posts) { foreach ($posts as $post) { start_b2(); ?>
<?php foreach ($posts as $post) { start_b2(); ?>
<item rdf:about="<?php permalink_single_rss() ?>"> <item rdf:about="<?php permalink_single_rss() ?>">
<title><?php the_title_rss() ?></title> <title><?php the_title_rss() ?></title>
<link><?php permalink_single_rss() ?></link> <link><?php permalink_single_rss() ?></link>
@ -94,6 +90,5 @@ if (!isset($rss_language)) { $rss_language = 'en'; }
?> ?>
<content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded> <content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded>
</item> </item>
<?php } ?> <?php } } ?>
</rdf:RDF> </rdf:RDF>

View File

@ -55,7 +55,7 @@ if (!isset($rss_excerpt_length) || ($rss_encoded_html == 1)) { $rss_excerpt_leng
<webMaster><?php echo $admin_email ?></webMaster> <webMaster><?php echo $admin_email ?></webMaster>
<language><?php echo $rss_language ?></language> <language><?php echo $rss_language ?></language>
<?php $items_count = 0; foreach ($posts as $post) { start_b2(); ?> <?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_b2(); ?>
<item> <item>
<title><?php the_title_rss() ?></title> <title><?php the_title_rss() ?></title>
<?php <?php
@ -74,6 +74,6 @@ if ($rss_use_excerpt) {
?> ?>
<link><?php permalink_single_rss() ?></link> <link><?php permalink_single_rss() ?></link>
</item> </item>
<?php $items_count++; if (($items_count == $posts_per_rss) && empty($m)) { break; } } ?> <?php $items_count++; if (($items_count == $posts_per_rss) && empty($m)) { break; } } } ?>
</channel> </channel>
</rss> </rss>

View File

@ -66,7 +66,7 @@ if (!isset($rss_excerpt_length) || ($rss_encoded_html == 1)) { $rss_excerpt_leng
<sy:updateFrequency>1</sy:updateFrequency> <sy:updateFrequency>1</sy:updateFrequency>
<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase> <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
<?php $items_count = 0; foreach ($posts as $post) { start_b2(); ?> <?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_b2(); ?>
<item rdf:about="<?php permalink_single_rss() ?>"> <item rdf:about="<?php permalink_single_rss() ?>">
<title><?php the_title_rss() ?></title> <title><?php the_title_rss() ?></title>
<link><?php permalink_single_rss() ?></link> <link><?php permalink_single_rss() ?></link>
@ -86,6 +86,6 @@ if (!isset($rss_excerpt_length) || ($rss_encoded_html == 1)) { $rss_excerpt_leng
?> ?>
<content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded> <content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded>
</item> </item>
<?php $items_count++; if (($items_count == $posts_per_rss) && empty($m)) { break; } } ?> <?php $items_count++; if (($items_count == $posts_per_rss) && empty($m)) { break; } } } ?>
</channel> </channel>
</rss> </rss>