Skip to content

Commit

Permalink
fixed header and footer issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Shemona Singh authored and Shemona Singh committed Dec 4, 2017
1 parent 54bade5 commit f4837a5
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 2 additions & 0 deletions www/application/controllers/All_Tweets.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ function __Construct(){

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('home', $this->data); // load the view file , we are passing $data array to view file
$this->load->view('templates/footer', NULL);
}

}
7 changes: 3 additions & 4 deletions www/application/controllers/User_Tweets.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Users_Tweets extends CI_Controller {
class User_Tweets extends CI_Controller {

function __Construct(){
parent::__Construct ();
$this->load->library('session');
$this->load->database(); // load database
$this->load->model('Users_Tweets_Model'); // load model
$this->load->model('User_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->data['posts'] = $this->User_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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
class User_Tweets_Model extends CI_Model {

function getPosts(){

$_SESSION['user_id'] = $id;


$this->db->select("first_name, last_name, username, tweet, date_time");
Expand Down
2 changes: 1 addition & 1 deletion www/application/views/home.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<?php echo $post['first_name'];?>
<?php echo $post['last_name'];?>
<?php echo $post['username'];?>
</div>
</div>
<div class="col-md-8">
<?php echo $post['tweet'];?>
<?php echo $post['date_time'];?>
Expand Down
1 change: 1 addition & 0 deletions www/application/views/templates/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
<body>

<h1><?php echo $title; ?></h1>
<h2>Hello</h2>
1 change: 0 additions & 1 deletion www/application/views/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<div class="row">
<?php foreach($posts as $post){?>
<div class="col-md-4">
<?php echo $post['first_name'];?>
<?php echo $post['last_name'];?>
<?php echo $post['username'];?>
</div>
Expand Down
1 change: 1 addition & 0 deletions www/tmp/ci_session27ff9b439dbea0a593e5a60be5666916b5b2a907
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__ci_last_regenerate|i:1512329390;

0 comments on commit f4837a5

Please sign in to comment.