From 1ac68c035e2a264ab00baab323fca3b2772b6cbe Mon Sep 17 00:00:00 2001 From: Dylan Lloyd Date: Sat, 24 Mar 2012 15:17:25 -0400 Subject: [PATCH] index layout now fully separated m/v/c --- model/index.php | 19 +++++++++++++------ view/index.php | 14 ++++++++++++-- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/model/index.php b/model/index.php index dc8f6b3..f649ecc 100644 --- a/model/index.php +++ b/model/index.php @@ -2,25 +2,32 @@ class index extends model { + public $exhibits = array(); + public $projects = array(); + + public function __construct() { + parent::__construct(); + $this->fetch_exhibits(); + $this->fetch_projects(); + } + public function display() { require_once("view/index.php"); } - public function display_exhibits() { - echo "
"; + private function fetch_exhibits() { $sql = "SELECT text FROM projects ORDER BY rank"; $result = $this->db->query($sql); while ($entry = $result->fetch_object()) { - echo $entry->text; + $this->exhibits[] = $entry->text; } - echo "
"; } - public function list_projects() { + private function fetch_projects() { $sql = "SELECT title FROM projects ORDER BY rank"; $result = $this->db->query($sql); while ($entry = $result->fetch_object()) { - echo "
  • $entry->title
  • "; + $this->projects[] = $entry->title; } } diff --git a/view/index.php b/view/index.php index fb2ed19..2f9b0c9 100644 --- a/view/index.php +++ b/view/index.php @@ -34,12 +34,22 @@ border="0">
    - display_exhibits() ?> +
    + exhibits as $exhibit) { + echo $exhibit; + } + ?> +