summaryrefslogtreecommitdiff
path: root/skin/rss.skin.php
diff options
context:
space:
mode:
Diffstat (limited to 'skin/rss.skin.php')
-rw-r--r--skin/rss.skin.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/skin/rss.skin.php b/skin/rss.skin.php
new file mode 100644
index 0000000..0806182
--- /dev/null
+++ b/skin/rss.skin.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace skin\rss;
+
+function atom($ctx, $title, $link, $rss_link, $items) {
+return <<<HTML
+<?xml version="1.0" encoding="UTF-8"?>
+<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
+ <channel>
+ <title>{$title}</title>
+ <link>{$link}</link>
+ <description/>
+ <atom:link href="{$rss_link}" rel="self" type="application/rss+xml"/>
+ {$ctx->for_each($items, fn($item) => $ctx->item(...$item))}
+ </channel>
+</rss>
+HTML;
+}
+
+function item($ctx, $title, $link, $pub_date, $description) {
+return <<<HTML
+<item>
+ <title>{$title}</title>
+ <link>{$link}</link>
+ <pubDate>{$pub_date}</pubDate>
+ <description>{$description}</description>
+</item>
+HTML;
+} \ No newline at end of file