added powermate css
[dylansserver.git] / model / rss.php
1 <?php
2
3 class rss extends model {
4
5 public function display() {
6 require_once("view/rss.php");
7 }
8
9 public function display_items() {
10 $result = $this->db->query("SELECT date_posted, title, text, url
11 FROM notes ORDER BY date_posted DESC
12 LIMIT 5");
13 while ($entry = $result->fetch_object()) {
14 $title = $entry->title;
15 $date_posted = $entry->date_posted;
16 $url = "http://dylansserver.com/note/" . $entry->url;
17 $text = $entry->text;
18 $text = strip_tags($text);
19 $end_of_first_sentence = strpos($text, '.');
20 if ($end_of_first_sentence) {
21 $end_of_second_sentence = strpos($text, '.', ($end_of_first_sentence + 1));
22 if ($end_of_second_sentence) {
23 $description = substr($text, '0', ($end_of_second_sentence + 1));
24 } else {
25 $description = substr($text, '0', ($end_of_first_sentence + 1));
26 }
27 }
28 echo "<item>";
29 echo " <title>$title</title>";
30 echo " <link>$url</link>";
31 echo " <guid>$url</guid>";
32 echo " <description>$description</description>";
33 echo "</item>";
34 }
35 }
36 }
37
38 ?>