Exemple #1
0
 public function view($id)
 {
     $this->data['title'] = "View Post";
     $p = new Blogpost();
     if ($p->exists($id)) {
         $p->get_where(array('id' => $id));
         $this->data['post'] = $p;
         $this->data['title'] .= ' - ' . $p->title;
         $c = new Blogcomment();
         $c->where('post_id = ' . $p->id);
         $this->data['commentcount'] = $c->count();
     } else {
         $this->data['messages']['errors'][] = "No post by that id found.";
     }
     $this->load->view('post_view', $this->data);
 }