nieuws/feed: represent last update by publish date
[minimedit.git] / nieuws / feed / index.php
1 <?php
2 ob_clean();
3 print '<?xml version="1.0" encoding="utf-8"?>';
4 $siteref = 'http://'.$_SERVER['HTTP_HOST'];
5 ?>
6
7 <feed xmlns="http://www.w3.org/2005/Atom">
8         <title>Lijtweg.nl</title>
9         <subtitle>Nieuwsberichten</subtitle>
10         <id><?= $siteref ?></id>
11         <link href="<?= $siteref ?>" />
12         <link href="<?= $siteref . $_SERVER['REQUEST_URI'] ?>" rel="self" />
13         <author><name>Lijtweg</name></author>
14 <?php
15 include 'nieuws.inc.php';
16 $root = preg_replace('{/feed$}', '', $Page) . "/2???";
17 $pages = array_reverse(glob("$root/*.html"));
18
19 foreach ($pages as $i => $page) {
20         $article = new ArchiveArticle($page);
21         if (!$i) {
22                 // feed metadata from top (most recent) article
23                 print "\t<updated>{$article->lastiso}</updated>\n";
24         }
25 ?>
26
27         <entry>
28                 <id><?= $siteref . '/' . $article->link ?></id>
29                 <link href="/<?= $article->link ?>" />
30                 <title><?= $article->title ?></title>
31                 <published><?= $article->dateiso ?></published>
32                 <updated><?= $article->dateiso ?></updated>
33                 <content type="html"><?= htmlspecialchars($article->body) ?></content>
34 <?php
35         if ($article->thumb) {
36                 printf("\t\t".'<link rel="enclosure" type="%s" length="%d" href="%s" />'."\n",
37                         'image/jpeg', filesize($article->thumb), "$siteref/{$article->thumb}"
38                 );
39         }
40 ?>
41         </entry>
42 <?php
43 }
44 ?>
45 </feed>
46 <?php
47 exit;