diff --git a/www/application/controllers/All_Tweets.php b/www/application/controllers/All_Tweets.php index fbad88c..d5bcca1 100644 --- a/www/application/controllers/All_Tweets.php +++ b/www/application/controllers/All_Tweets.php @@ -7,7 +7,7 @@ function __Construct(){ parent::__Construct (); $this->load->database(); // load database $this->load->model('All_Tweets_Model'); // load model - $this->output->disable_profiler(TRUE); + $this->output->enable_profiler(TRUE); } public function index() { diff --git a/www/application/controllers/User_Tweets.php b/www/application/controllers/User_Tweets.php new file mode 100644 index 0000000..c97e90b --- /dev/null +++ b/www/application/controllers/User_Tweets.php @@ -0,0 +1,19 @@ +load->library('session'); + $this->load->database(); // load database + $this->load->model('Users_Tweets_Model'); // load model + $this->output->enable_profiler(TRUE); + } + + public function index() { + $this->data['posts'] = $this->Users_Tweets_Model->getPosts(); // calling Post model method getPosts() + $this->load->view('user', $this->data); // load the view file , we are passing $data array to view file + } + +} diff --git a/www/application/models/Users_Tweets_Model.php b/www/application/models/Users_Tweets_Model.php new file mode 100644 index 0000000..e67ae08 --- /dev/null +++ b/www/application/models/Users_Tweets_Model.php @@ -0,0 +1,18 @@ +db->select("first_name, last_name, username, tweet, date_time"); + $this->db->from('Users, Tweets'); + $this->db->where('Users.id = Tweets.user_id'); + $this->db->order_by('date_time', 'DESC'); + $query = $this->db->get(); + return $query->result_array(); + } + +} +?> diff --git a/www/application/views/user.php b/www/application/views/user.php new file mode 100644 index 0000000..535a957 --- /dev/null +++ b/www/application/views/user.php @@ -0,0 +1,32 @@ + + + + + User Tweets + + + + +

Tweets Feed

+
+
+ +
+ + + +
+
+ + +
+ +
+
+ + +