-
-
Save fluffy-critter/528a42d474284f3ad112e7a3fc541f62 to your computer and use it in GitHub Desktop.
puppy space pirates rss feed example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
To use this, put it in your site root directory, and add the following to | |
the <head> section of your index.php: | |
<link rel="alternate" type="application/rss+xml" title="RSS" href="rss.php"> | |
*/ | |
header('Content-Type: application/rss+xml'); | |
echo '<?xml version="1.0" encoding="UTF-8" ?>'; | |
?><rss version="2.0"> | |
<channel> | |
<title>Puppy Space Pirates</title> | |
<description>The offical comic adaptation of the movie</description> | |
<link>http://puppyspacepirates.com/</link> | |
<?php | |
$comics = scandir('comics', SCANDIR_SORT_DESCENDING); | |
foreach ($comics as $filename) { | |
$pathinfo = pathinfo($filename); | |
if ($pathinfo['extension'] == 'png' || $pathinfo['extension'] == 'jpg') { | |
$page = $pathinfo['filename']; | |
$link = "http://puppyspacepirates.com/?id=$page"; | |
?> | |
<item><title>Page <?=$page?></title> | |
<link><?=$link?></link> | |
<description><![CDATA[<a href="<?=$link?>"><img src="http://puppyspacepirates.com/comics/<?=$filename?>"></a>]]></description> | |
<guid isPermaLink="true"><?=$link?></guid> | |
<pubDate><?=date('r', filemtime("comics/$filename"))?></pubDate> | |
</item> | |
<?php | |
} | |
} | |
?> | |
</channel></rss> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment