diff --git a/index.php b/index.php new file mode 100644 index 0000000..139509d --- /dev/null +++ b/index.php @@ -0,0 +1,5 @@ +format('m/d/y'); ?> diff --git a/www/application/controllers/All_Tweets.php b/www/application/controllers/All_Tweets.php index 4e32d65..6974b1a 100644 --- a/www/application/controllers/All_Tweets.php +++ b/www/application/controllers/All_Tweets.php @@ -14,6 +14,7 @@ public function index() { $this->data['posts'] = $this->All_Tweets_Model->getPosts(); // calling Post model method getPosts() $this->load->view('templates/header', NULL); + $this->load->view('templates/nav', NULL); $this->load->view('home', $this->data); // load the view file , we are passing $data array to view file $this->load->view('templates/footer', NULL); } @@ -22,9 +23,10 @@ function search_keyword(){ $keyword = $this->input->post('keyword'); $data['results'] = $this->All_Tweets_Model->search($keyword); - $this->load->view('templates/header'); + $this->load->view('templates/header', NULL); + $this->load->view('templates/nav', NULL); $this->load->view('home', $data); // load the view file , we are passing $data array to view file - $this->load->view('templates/footer'); + $this->load->view('templates/footer', NULL); } } diff --git a/www/application/controllers/Login.php b/www/application/controllers/Login.php index da638ce..2fb8078 100644 --- a/www/application/controllers/Login.php +++ b/www/application/controllers/Login.php @@ -5,7 +5,7 @@ function __Construct(){ parent::__Construct(); $this->load->database(); // load database $this->load->model('User_Info_Model'); // load model - $this->output->enable_profiler(TRUE); + //$this->output->enable_profiler(TRUE); } public function index(){ @@ -15,8 +15,12 @@ public function index(){ $this->form_validation->set_rules('username', 'Username', 'required'); $this->form_validation->set_rules('password', 'Password', 'required'); - if ($this->form_validation->run() == FALSE) + if ($this->form_validation->run() == FALSE){ + $this->load->view('templates/header'); $this->load->view('login'); + $this->load->view('templates/footer'); + } + // load the homepage if login successful // https://www.codeigniter.com/user_guide/libraries/form_validation.html#callbacks-your-own-validation-methods @@ -30,7 +34,11 @@ public function index(){ redirect('/all_tweets'); } // if no, refresh login - else $this->load->view('login', $data); + else { + $this->load->view('templates/header'); + $this->load->view('login', $data); + $this->load->view('templates/footer'); + } } } diff --git a/www/application/controllers/Register.php b/www/application/controllers/Register.php index f8ff82b..5b6db13 100644 --- a/www/application/controllers/Register.php +++ b/www/application/controllers/Register.php @@ -22,8 +22,11 @@ public function index(){ array('required' => 'You must provide a %s.')); $this->form_validation->set_rules('email', 'Email', 'required|valid_email'); - if ($this->form_validation->run() == FALSE) - $this->load->view('register'); + if ($this->form_validation->run() == FALSE){ + $this->load->view('templates/header'); + $this->load->view('register'); + $this->load->view('templates/footer'); + } // load the homepage once properly submitted // https://www.codeigniter.com/user_guide/libraries/form_validation.html#callbacks-your-own-validation-methods diff --git a/www/application/controllers/Tweet.php b/www/application/controllers/Tweet.php deleted file mode 100644 index 6f8945d..0000000 --- a/www/application/controllers/Tweet.php +++ /dev/null @@ -1,29 +0,0 @@ -load->database(); // load database - $this->load->model('User_Tweets_Model'); // load model - $this->output->enable_profiler(TRUE); - } - - public function index(){ - $this->load->helper('form'); - $this->load->library('form_validation'); - - $data['title'] = 'Create a tweet'; - - $this->form_validation->set_rules('tweet', 'Tweet', 'required'); - - if ($this->form_validation->run() === FALSE) - { - $this->load->view('tweet', $data); - } - else - { - $this->User_Tweets_Model->addTweet(); - $this->load->view('formsuccess'); - } - } -} diff --git a/www/application/controllers/User_Tweets.php b/www/application/controllers/User_Tweets.php index fc5b71c..8f7cedb 100644 --- a/www/application/controllers/User_Tweets.php +++ b/www/application/controllers/User_Tweets.php @@ -14,6 +14,7 @@ function __Construct(){ public function index() { $this->data['posts'] = $this->User_Tweets_Model->getPosts(); // calling Post model method getPosts() $this->load->view('templates/header', NULL); + $this->load->view('templates/nav', NULL); $this->load->view('user', $this->data); // load the view file , we are passing $data array to view file $this->load->view('templates/footer', NULL); } @@ -27,6 +28,7 @@ public function create(){ { $this->data['posts'] = $this->User_Tweets_Model->getPosts(); // calling Post model method getPosts() $this->load->view('templates/header', NULL); + $this->load->view('templates/nav'); $this->load->view('user', $this->data); // load the view file , we are passing $data array to view file $this->load->view('templates/footer', NULL); } diff --git a/www/application/views/home.php b/www/application/views/home.php index e2d71ab..b981a2b 100644 --- a/www/application/views/home.php +++ b/www/application/views/home.php @@ -14,20 +14,27 @@ load->library('form_validation'); ?> - - - + +