-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.uconn.edu/shs12010/twitter-clone
- Loading branch information
Showing
3 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
defined('BASEPATH') OR exit('No direct script access allowed'); | ||
|
||
class All_Tweets extends CI_Controller { | ||
|
||
function __Construct(){ | ||
parent::__Construct (); | ||
$this->load->database(); // load database | ||
$this->load->model('All_Tweets_Model'); // load model | ||
$this->output->enable_profiler(TRUE); | ||
} | ||
|
||
public function index() { | ||
$this->data['posts'] = $this->All_Tweets_Model->getPosts(); // calling Post model method getPosts() | ||
$this->load->view('home', $this->data); // load the view file , we are passing $data array to view file | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
class All_Tweets_Model extends CI_Model { | ||
|
||
function getPosts(){ | ||
$this->db->select("first_name,last_name,username"); | ||
$this->db->from('Users'); | ||
$query = $this->db->get(); | ||
var_dump($query->result_array()); | ||
// return $query->result(); | ||
} | ||
|
||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,31 @@ | ||
<?php echo "This is the homepage with a list of all tweets."; ?> | ||
<?php | ||
defined('BASEPATH') OR exit('No direct script access allowed'); | ||
?><!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>All Tweets</title> | ||
<style type="text/css"> | ||
|
||
</style> | ||
</head> | ||
<body> | ||
|
||
<h4>Output Data</h4> | ||
<table> | ||
<tr> | ||
<td><strong>Post Id</strong></td> | ||
<td><strong>Post Title</strong></td> | ||
</tr> | ||
<?php foreach($posts as $post){?> | ||
<tr> | ||
<td><?php echo $post->first_name;?></td> | ||
<td><?php echo $post->last_name;?></td> | ||
</tr> | ||
<?php }?> | ||
</table> | ||
|
||
</div> | ||
|
||
</body> | ||
</html> |