[eluser]Dave Blencowe[/eluser]
mdl_blog.php comments function
Code:
function get_comments($id)
{
$this->db->order_by('id', 'desc');
$this->db->where('post_id', $id);
$comments = $this->db->get('content_test');
return $comments->row_array();
}
blog.php Comments function
Code:
function comments()
{
$this->load->view('template/default/header');
$id = $this->uri->segment(3);
$get_blog = $this->mdl_blog->get_blog($id, '1');
$get_comments = $this->mdl_blog->get_comments($id);
$this->load->view('blog/comments/main_view', $get_blog);
$this->load->view('blog/comments/comments_view', $get_comments);
$this->load->view('blog/comments/comments_add');
$this->load->view('template/default/footer');
}
Comments_view.php
Code:
<br />
<table border="0" cellspacing="3" cellpadding="0" width="600px">
<tr bgcolor="#AECFF0">
<td colspan="2"><?php echo $subject; ?></td>
</tr>
<tr bgcolor="#AECFF0">
<td rowspan="2"> </td>
<td style="padding-left: 10px;"><?php echo(nl2br($comment)); ?></td>
</tr>
<tr bgcolor="#AECFF0">
<td style="padding-left: 10px;"><?php echo("".$name." - ".$timestamp."");?></td>
</tr>
</table>
</center>