Advertisement
sinaga15

Untitled

Nov 15th, 2017
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. <?php
  2. class Data extends CI_Model {
  3. public function __construct(){
  4. $this->load->database();
  5. $this->load->library('encrypt');
  6.  
  7. }
  8. public function alls()
  9. {
  10. $this->db->select('`id`,`slug`,`datecreated`,`datechanged`,`datepublish`,`datedepublish`,`ownerid`,`status`,
  11. `title`,`news_author`,`summary`,`content`,`is_headline`,`compartment`,`image`,`image_source`,`image_caption`,
  12. `video`,`news_type`,`edition`,`old_id`,`old_table`,`hot_comment`,`hits`,`is_chosen`,`is_locked `,
  13. `meta_keyword `');
  14. $this->db->from('micom_news');
  15. $this->db->group_by('datecreated','desc');
  16.  
  17. //$this->db->where('id_kategori', '19');
  18.  
  19. $this->db->limit(200 , 0);
  20. $query = $this->db->get();
  21. return $query->result_array();
  22. }
  23.  
  24.  
  25. public function all(){
  26. $this->db->select('*');
  27. $this->db->from('micom_news');
  28. $this->db->limit(20 , 0);
  29.  
  30. //$this->db->join(micom_users.' as u' , 'p.id = u.id');
  31. //$this->db->join('micom_compartments ON micom_news.compartment = micom_compartments.id where micom_compartments.id = 4');
  32.  
  33. //$this->db->join('micom_compartments', 'micom_news.compartment = micom_compartments.id');
  34. //$this->db->join('micom_compartments', 'micom_news.compartment = micom_compartments.title', 'inner');
  35. //$this->db->where('p.user_id > 1 GROUP BY p.user_id');
  36. $this->db->order_by('id','desc');
  37. $query = $this->db->get();
  38. return $query->result_array();
  39. }
  40.  
  41.  
  42.  
  43. public function populer(){
  44. $this->db->select('*');
  45. $this->db->from('micom_news');
  46. $this->db->limit(10 , 0);
  47.  
  48. //$this->db->join(micom_users.' as u' , 'p.id = u.id');
  49. //$this->db->join('micom_compartments ON micom_news.compartment = micom_compartments.id where micom_compartments.id = 4');
  50.  
  51. //$this->db->join('micom_compartments', 'micom_news.compartment = micom_compartments.id');
  52. //$this->db->join('micom_compartments', 'micom_news.compartment = micom_compartments.title', 'inner');
  53. //$this->db->where('p.user_id > 1 GROUP BY p.user_id');
  54. $this->db->order_by('hits');
  55. $query = $this->db->get();
  56. return $query->result_array();
  57. }
  58.  
  59.  
  60.  
  61. public function get($idartikel) {
  62. //$sinaga = array();
  63. $this->db->query("select * from micom_news");
  64. $this->db->from('micom_news');
  65. //$this->db->join('micom_compartments', 'micom_news.compartment = micom_compartments.title', 'inner');
  66. //$this->db->join('micom_compartments', 'micom_news.compartment = micom_compartments.id', 'inner');
  67. //$this->db->join('micom_news', 'micom_compartments.id = micom_news.compartment', 'inner');
  68. //$result = $this->db->query();
  69. $id = $this->db->insert_id();
  70. $sql = $this->db->get_where($this->read, array('slug' =>isset($idartikel) ? $idartikel : ""));
  71. $t = $sql->result_array();
  72. return $t;
  73. //echo "<pre>";
  74. //print_r($t);
  75. //echo "</pre>";
  76.  
  77. //$t = $this->db->get($sql)->row_array();
  78. //return $this->db->get();
  79. }
  80.  
  81.  
  82. }
  83. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement