";
+ $sql = "SELECT text FROM projects
+ WHERE title = ?";
+ $result = $this->query($sql, "s", $_GET['project']);
+ if ($result = $result[0]['text']) {
+ $text = str_replace("class='exhibit'", "class='exhibit' style='display:block;'", $result);
+ echo $text;
+ echo "
";
+ } else {
+ throw new notFound();
+ }
+ }
+
+}
+
+
+class page extends cms {
+
+ private $page = 1;
+ private $offset = 0;
+ private $notes_per_page = 4;
+ private $number_of_pages = 1;
+
+ public function __construct() {
+ parent::__construct();
+ $this->page_offset();
+ }
+
+ private function page_offset() {
+ $sql = "SELECT COUNT(*) FROM notes";
+ $result = $this->db->query($sql);
+ $result = $result->fetch_array();
+ $this->number_of_pages = ceil($result[0] / $this->notes_per_page);
+ if (isset($_GET['page']) && is_numeric($_GET['page'])) {
+ $this->page = (int) $_GET['page'];
+ } else {
+ throw new notFound();
+ }
+ if ($this->page > $this->number_of_pages) {
+ throw new notFound();
+ }
+ if ($this->page < 1) {
+ throw new notFound();
+ }
+ $this->offset = ($this->page - 1) * $this->notes_per_page;
+ }
+
+ public function display() {
+ $this->display_head();
+ echo "";
+ $sql = "SELECT date_posted, title, url, text
+ FROM notes ORDER BY date_posted DESC
+ LIMIT ?, ?";
+ $result = $this->query($sql, "ii",
+ $this->offset,
+ $this->notes_per_page);
+ foreach ($result as $row => $entry) {
+ $title = $entry['title'];
+ $url = '/note/' . $entry['url'];
+ $date_posted = explode("-", $entry['date_posted']);
+ $year_posted = $date_posted[0];
+ $month_posted = $date_posted[1];
+ $datetime_posted = explode(' ', $date_posted[2]);
+ $day_posted = $datetime_posted[0];
+ echo "
";
+ echo "
$year_posted/$month_posted/$day_posted/$title
";
+ echo $entry['text'];
+ echo "
";
+ }
+ echo "
";
+ $this->write_navigation();
+ $this->display_close();
+ }
+
+ private function write_navigation() {
+ echo "
$author
"; + echo <<