From: Mischa POSLAWSKY Date: Sat, 25 Aug 2018 21:51:17 +0000 (+0200) Subject: nieuws/feed: atom export of articles X-Git-Tag: v3.7~17 X-Git-Url: http://git.shiar.net/minimedit.git/commitdiff_plain/2cdc2cb95e16975c4d210f8cebcc8b04a43b79ad nieuws/feed: atom export of articles --- diff --git a/nieuws.inc.php b/nieuws.inc.php index a925a91..c5dfa23 100644 --- a/nieuws.inc.php +++ b/nieuws.inc.php @@ -42,10 +42,30 @@ class ArchiveArticle return strip_tags($this->title); } + function last() + { + return filemtime($this->page); + } + + function lastiso() + { + return date(DATE_ATOM, $this->last); + } + + function dateparts() + { + preg_match('', $this->page, $ymd); + return $ymd; + } + + function dateiso() + { + return implode('-', $this->dateparts()); + } + function date() { - if (!preg_match('', $this->page, $parts)) return; - return showdate($parts); + return showdate($this->dateparts); } function body() diff --git a/nieuws/feed/index.php b/nieuws/feed/index.php new file mode 100644 index 0000000..eff9203 --- /dev/null +++ b/nieuws/feed/index.php @@ -0,0 +1,47 @@ +'; +$siteref = 'http://'.$_SERVER['HTTP_HOST']; +?> + + + Lijtweg.nl + Nieuwsberichten + + + + Lijtweg + $page) { + $article = new ArchiveArticle($page); + if (!$i) { + // feed metadata from top (most recent) article + print "\t{$article->lastiso}\n"; + } +?> + + + link ?> + + <?= $article->title ?> + dateiso ?> + lastiso ?> + body) ?> +thumb) { + printf("\t\t".''."\n", + 'image/jpeg', filesize($article->thumb), "$siteref/{$article->thumb}" + ); + } +?> + + + +