new title font, bg img, abstract title name to ini file
[dylansserver.git] / model / rss.php
1 <?php
2
3 class rss extends model {
4
5 public $items = array();
6
7 public function display() {
8 $this->fetch_items();
9 require_once("view/rss.php");
10 }
11
12 public function fetch_items() {
13 $result = $this->db->query("SELECT date_posted, title, text, url
14 FROM notes ORDER BY date_posted DESC
15 LIMIT 5");
16 while ($entry = $result->fetch_object()) {
17 $entry->url = "http://dylansserver.com/note/" . $entry->url;
18 $entry->text = strip_tags($entry->text);
19 $end_of_first_sentence = strpos($entry->text, '.');
20 if ($end_of_first_sentence) {
21 $end_of_second_sentence = strpos($entry->text, '.', ($end_of_first_sentence + 1));
22 if ($end_of_second_sentence) {
23 $entry->description = substr($entry->text, '0', ($end_of_second_sentence + 1));
24 } else {
25 $entry->description = substr($entry->text, '0', ($end_of_first_sentence + 1));
26 }
27 foreach ($entry as $key => $val) {
28 $this->items[][$key] = $entry->$key;
29 }
30 }
31 }
32 }
33 }
34
35 ?>