rss now from view/rss.php
authorDylan Lloyd <dylan@dylansserver.com>
Thu, 22 Mar 2012 23:24:34 +0000 (19:24 -0400)
committerDylan Lloyd <dylan@dylansserver.com>
Thu, 22 Mar 2012 23:24:34 +0000 (19:24 -0400)
cms.php
view/rss.php [new file with mode: 0644]

diff --git a/cms.php b/cms.php
index b4790b2..1f455a4 100644 (file)
--- a/cms.php
+++ b/cms.php
@@ -487,18 +487,15 @@ class archive extends cms {
 
 
 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;
@@ -514,18 +511,13 @@ END_OF_ENTRY;
                  $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>";
-    
   }
 }
 
diff --git a/view/rss.php b/view/rss.php
new file mode 100644 (file)
index 0000000..2f55ca3
--- /dev/null
@@ -0,0 +1,9 @@
+<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>