From: Dylan Lloyd Date: Fri, 23 Mar 2012 08:56:21 +0000 (-0400) Subject: rss now using model X-Git-Url: https://disinclined.org/git/?a=commitdiff_plain;h=0e6804f62c676f4dba6050e7cd2b1b5fffeac867;p=dylansserver.git rss now using model --- diff --git a/cms.php b/cms.php index 428cae1..b5b3b20 100644 --- a/cms.php +++ b/cms.php @@ -94,8 +94,9 @@ abstract class cms { require_once("view/page.php"); break; case "rss": + require_once("model/rss.php"); $rss = new rss(); - $rss->display(); + require_once("view/rss.php"); break; case 'archive': $archive = new archive; @@ -235,42 +236,6 @@ 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"); - while ($entry = $result->fetch_object()) { - $title = $entry->title; - $date_posted = $entry->date_posted; - $url = "http://dylansserver.com/note/" . $entry->url; - $text = $entry->text; - $text = strip_tags($text); - $end_of_first_sentence = strpos($text, '.'); - if ($end_of_first_sentence) { - $end_of_second_sentence = strpos($text, '.', ($end_of_first_sentence + 1)); - if ($end_of_second_sentence) { - $description = substr($text, '0', ($end_of_second_sentence + 1)); - } else { - $description = substr($text, '0', ($end_of_first_sentence + 1)); - } - } - echo ""; - echo " $title"; - echo " $url"; - echo " $url"; - echo " $description"; - echo ""; - } - } -} - - class notFound extends Exception { public function __construct() { diff --git a/view/rss.php b/view/rss.php index 2f55ca3..4e2609b 100644 --- a/view/rss.php +++ b/view/rss.php @@ -4,6 +4,6 @@ http://dylansserver.com/notes dylansserver.com/notes/rss - display_items() ?> + display_items() ?>