3 class rss
extends model
{
5 public $items = array();
7 public function display() {
9 require_once("view/rss.php");
12 public function fetch_items() {
13 $result = $this->db
->query("SELECT date_posted, title, text, url
14 FROM notes ORDER BY date_posted DESC
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));
25 $entry->description
= substr($entry->text
, '0', ($end_of_first_sentence +
1));
27 foreach ($entry as $key => $val) {
28 $this->items
[][$key] = $entry->$key;