<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class News extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->model('news_model');
        $this->load->model('model_app');
    }

    public function index() {
        $data['num_messages'] = $this->news_model->num_messages();
        $data['latest_messages'] = $this->news_model->get_messages();
//	/$this->load->view('twitterpagination/index', $data);
        $data['judul'] = "Amazink News | amazinkprint.com";
        $data['title'] = "Amazink News | amazinkprint.com";
        $data['home'] = "";
        $this->load->view('frontamazink/header.php', $data);
        $this->load->view('frontamazink/v_menu.php', $data);
        $this->load->view('frontamazink/v_news_index', $data);
        $this->load->view('frontamazink/footer.php', $data);
    }
    
    function read(){
        $key['id'] = $this->uri->segment(3);
        $fav['fav'] = 1;
        $data = array(
            'title' => "Artikel News | amazinkprint.com",
            'artikel' => $this->model_app->getSelectedData('article', $key),
        );
        $this->load->view('frontamazink/header.php', $data);
        $this->load->view('frontamazink/v_menu.php', $data);
        $this->load->view('frontamazink/v_artikel_read', $data);
        $this->load->view('frontamazink/footer.php', $data);
    }

    function insert_rows() {
        $i = 0;
        while ($i < 50) {
            $i++;
            $data = array('username' => 'user', 'message' => 'message ' . $i);
            $this->db->insert('twitter_messages', $data);
            echo $i . '<br />';
        }
    }

    function get_messages($offset) {
        $data['latest_messages'] = $this->news_model->get_messages($offset);
        $this->load->view('frontamazink/v_news_load', $data);
    }

}

/* End of file news.php */
/* Location: ./application/controllers/news.php */