class rss extends cms {
+
public function display() {
+ require_once("view/rss.php");
+ }
+
+ public function display_items() {
$result = $this->db->query("SELECT date_posted, title, text, url
FROM notes ORDER BY date_posted DESC
LIMIT 5");
- echo <<<END_OF_ENTRY
- <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
- <channel>
- <title>dylansserver.com/notes/rss</title>
- <link>http://dylansserver.com/notes</link>
- <description>dylansserver.com/notes/rss</description>
- <atom:link href="http://dylansserver.com/notes/rss" rel="self" type="application/rss+xml" />
-END_OF_ENTRY;
while ($entry = $result->fetch_object()) {
$title = $entry->title;
$date_posted = $entry->date_posted;
$description = substr($text, '0', ($end_of_first_sentence + 1));
}
}
- echo <<<END_OF_ENTRY
- <item>
- <title>$title</title>
- <link>$url</link>
- <guid>$url</guid>
- <description>$description</description>
- </item>
-END_OF_ENTRY;
+ echo "<item>";
+ echo " <title>$title</title>";
+ echo " <link>$url</link>";
+ echo " <guid>$url</guid>";
+ echo " <description>$description</description>";
+ echo "</item>";
}
- echo "</channel>";
- echo "</rss>";
-
}
}
--- /dev/null
+<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
+ <channel>
+ <title>dylansserver.com/notes/rss</title>
+ <link>http://dylansserver.com/notes</link>
+ <description>dylansserver.com/notes/rss</description>
+ <atom:link href="http://dylansserver.com/notes/rss" rel="self" type="application/rss+xml" />
+ <?php $this->display_items() ?>
+ </channel>
+</rss>