X-Git-Url: https://disinclined.org/git/?a=blobdiff_plain;f=model%2Frss.php;fp=model%2Frss.php;h=b7c51642de09b1664afa06f55f5b35c0e0f648da;hb=77022111c645ce69584a681c17662264ff370d7c;hp=0000000000000000000000000000000000000000;hpb=0e6804f62c676f4dba6050e7cd2b1b5fffeac867;p=dylansserver.git diff --git a/model/rss.php b/model/rss.php new file mode 100644 index 0000000..b7c5164 --- /dev/null +++ b/model/rss.php @@ -0,0 +1,38 @@ +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 ""; + } + } +} + +?>