Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Data extends CI_Model {
- public function __construct(){
- $this->load->database();
- $this->load->library('encrypt');
- }
- public function alls()
- {
- $this->db->select('`id`,`slug`,`datecreated`,`datechanged`,`datepublish`,`datedepublish`,`ownerid`,`status`,
- `title`,`news_author`,`summary`,`content`,`is_headline`,`compartment`,`image`,`image_source`,`image_caption`,
- `video`,`news_type`,`edition`,`old_id`,`old_table`,`hot_comment`,`hits`,`is_chosen`,`is_locked `,
- `meta_keyword `');
- $this->db->from('micom_news');
- $this->db->group_by('datecreated','desc');
- //$this->db->where('id_kategori', '19');
- $this->db->limit(200 , 0);
- $query = $this->db->get();
- return $query->result_array();
- }
- public function all(){
- $this->db->select('*');
- $this->db->from('micom_news');
- $this->db->limit(20 , 0);
- //$this->db->join(micom_users.' as u' , 'p.id = u.id');
- //$this->db->join('micom_compartments ON micom_news.compartment = micom_compartments.id where micom_compartments.id = 4');
- //$this->db->join('micom_compartments', 'micom_news.compartment = micom_compartments.id');
- //$this->db->join('micom_compartments', 'micom_news.compartment = micom_compartments.title', 'inner');
- //$this->db->where('p.user_id > 1 GROUP BY p.user_id');
- $this->db->order_by('id','desc');
- $query = $this->db->get();
- return $query->result_array();
- }
- public function populer(){
- $this->db->select('*');
- $this->db->from('micom_news');
- $this->db->limit(10 , 0);
- //$this->db->join(micom_users.' as u' , 'p.id = u.id');
- //$this->db->join('micom_compartments ON micom_news.compartment = micom_compartments.id where micom_compartments.id = 4');
- //$this->db->join('micom_compartments', 'micom_news.compartment = micom_compartments.id');
- //$this->db->join('micom_compartments', 'micom_news.compartment = micom_compartments.title', 'inner');
- //$this->db->where('p.user_id > 1 GROUP BY p.user_id');
- $this->db->order_by('hits');
- $query = $this->db->get();
- return $query->result_array();
- }
- public function get($idartikel) {
- //$sinaga = array();
- $this->db->query("select * from micom_news");
- $this->db->from('micom_news');
- //$this->db->join('micom_compartments', 'micom_news.compartment = micom_compartments.title', 'inner');
- //$this->db->join('micom_compartments', 'micom_news.compartment = micom_compartments.id', 'inner');
- //$this->db->join('micom_news', 'micom_compartments.id = micom_news.compartment', 'inner');
- //$result = $this->db->query();
- $id = $this->db->insert_id();
- $sql = $this->db->get_where($this->read, array('slug' =>isset($idartikel) ? $idartikel : ""));
- $t = $sql->result_array();
- return $t;
- //echo "<pre>";
- //print_r($t);
- //echo "</pre>";
- //$t = $this->db->get($sql)->row_array();
- //return $this->db->get();
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement