Whatsup codeigniters!
I want to display total comments of my blog that I am building with codeigniter.
In my controller I have:

```
   function index() {

          $data['query'] = $this->blog_model->get_all_entries();
          $this->load->view('blog/index',$data);
   }

```

Function index() gets all posts.
and I have

```
  public function post($id) {
          $data['query'] = $this->blog_model->get_post($id);
          $data['comments'] = $this->blog_model->get_post_comment($id);
          $data['post_id'] = $id;
          $data['total_comments'] = $this->blog_model->total_comments($id);
          $this->load->view('blog/index',$data,TRUE);

          $this->load->helper('form');
          $this->load->library(array('form_validation','session'));
          //validation rules for post function

          $this->form_validation->set_rules('commentor','Name','required');
          $this->form_validation->set_rules('email','Your email','required|valid_email');
          $this->form_validation->set_rules('comment','Comment','required');

          if($this->blog_model->get_post($id))
          {
                 foreach($this->blog_model->get_post($id) as $row) 
                 {
                        //set page title
                        $data['title'] = $row->entry_name;
                 }
                 if($this->form_validation->run() == FALSE)
                 {
                        //if validation runs FALSE
                        $this->load->view('blog/post',$data);
                 }
                 else
                 {
                        //if valid
                        $name = $this->input->post('commentor');
                        $email = strtolower($this->input->post('email'));
                        $comment = $this->input->post('comment');
                        $post_id = $id;

                        $this->blog_model->add_new_comment($post_id,$name,$email,$comment);
                        $this->session->set_flashdata('message', '1 new comment added!');
                        redirect('blog/post/'.$id);
                  }
           }
           else
                  show_404();
   }

```

Basically, post($id) gets a post with id (single post) and display comments. I can print total comments number in single post. But how do i print total comments number in index() function where all posts are listed. Thank you!