Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
$entry = $SQL->RunQuery("SELECT * FROM entry ORDER BY time DESC LIMIT 0, 50");
$title = SITE_NAME . ' - RSS';
echo urldecode('%3C%3Fxml+version=%221.0%22+encoding=%22utf-8%22%3F%3E');
?><rss version="2.0">
<title><?php echo $title; ?></title>
<link><?php echo BASE_URL; ?></link>
<description>Powered by PageCookery Microblog v<?php echo $pcm_version; ?> Build <?php echo $pcm_build; ?></description>
<?php while ($item = $SQL->FetchArray($entry)) { ?>
<title><?php echo Format::Time($item['time'], 1); ?> 来自 <?php echo $item['from']; ?></title>
<link><?php echo BASE_URL; ?>?act=view&amp;id=<?php echo $item['id']; ?></link>
<description><![CDATA[<?php echo $item['content']; ?>
<?php $item['picture'] = $SQL->QueryRowsArray("SELECT * FROM picture WHERE entryid = " . $item['id']); ?>
<?php if ($item['picture']['id']) { ?>
<p class="image"><a href="<?php echo get_picture_url($item['picture']['id'], 'o'); ?>" title="<?php echo $item['picture']['filename']; ?>"><img src="<?php echo get_picture_url($item['picture']['id'], 'm'); ?>" alt="<?php echo $item['picture']['filename']; ?>" /></a></p>
<?php } ?>]]></description>
<pubDate><?php echo Format::Date($item['time'], 'D, j M Y H:i:s' , 0); ?> +0000</pubDate>
<?php } ?>
$data = ob_get_contents();
file_put_contents('rss.xml', $data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment