Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
ob_start();
$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">
<channel>
<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>
<language>zh</language>
<?php while ($item = $SQL->FetchArray($entry)) { ?>
<item>
<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>
</item>
<?php } ?>
</channel>
</rss>
<?php
$data = ob_get_contents();
ob_end_clean();
file_put_contents('rss.xml', $data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment