Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. function comments($page){
  2. $this->load->library('pagination');
  3.  
  4. $this->load->model("model_get");
  5.  
  6. $config['base_url'] = base_url('main/comments/'.$this->uri->segment(3).'/');
  7. $config['total_rows'] = $this->model_get->getCommentcount();
  8. $config['per_page'] = 5;
  9. $config['uri_segment'] = 4;
  10. $this->pagination->initialize($config);
  11.  
  12. $data["results"] = $this->model_get->getComments($config['per_page'], $page);
  13. $this->load->view('content_comment', $data);
  14. }
  15.  
  16. function getComments($limit, $start){
  17. $this->db->from('comments');
  18. $this->db->where('blog_id', $this->uri->segment(3));
  19. $this->db->limit($limit, $this->uri->segment(4));
  20. $results = $this->db->get();
  21.  
  22. if ($results)
  23. {
  24. return $results->result();
  25. }else{
  26.  
  27. return FALSE;
  28. }
  29. }
  30.  
  31. <?php
  32. foreach($results as $row){
  33. $text = $row->text;
  34. echo "<h3>". $text ."</h3>";
  35. $author = $row->author;
  36. echo "<p>". $author ."</p>";
  37. }
  38.  
  39. $this->db->order_by("blog_id", "desc");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement