Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // defined('BASEPATH') OR exit('No direct script access allowed');
- class Indeks extends CI_Controller {
- // public function __construct() {
- // parent::__construct();
- // }
- /**
- * Index Page for this controller.
- *
- * Maps to the following URL
- * http://example.com/index.php/welcome
- * - or -
- * http://example.com/index.php/welcome/index
- * - or -
- * Since this controller is set as the default controller in
- * config/routes.php, it's displayed at http://example.com/
- *
- * So any other public methods not prefixed with an underscore will
- * map to /index.php/welcome/<method_name>
- * @see https://codeigniter.com/user_guide/general/urls.html
- */
- /*
- public function __construct() {
- parent::__construct();
- $this->load->model('data', 'indeks');
- $this->load->library('session');
- $this->load->helper('date');
- }
- */
- public function index($indeks=0) {
- if ($indeks<0) {
- redirect('indeks');
- }
- $this->load->model('data', 'indeks');
- $this->load->helper('analytics');
- $this->load->helper('weburi');
- $this->load->helper('content');
- $this->load->library('pagination');
- //$this->output->cache(10);
- $this->output->delete_cache();
- $t['title'] = 'Kumpulan Berita Hari ini';
- $data['indeks'] = $t['title'] ;
- $t['indeks'] = $this->indeks->all_news($indeks);
- $raws_image = json_decode($t['indeks'][0]['image'],true) ;
- $offset = 20;
- $pagging = (int) $this->uri->segment(3,0);
- $start = ((($pagging - 0) * $offset) < 0) ? 0 : (($pagging - 0) * $offset);
- #Pagination Start
- $total_data = count($t['indeks']);
- $t['end_page'] = ($total_data >= 20) ? TRUE : FALSE;
- $pagging = ($pagging > 0 ? $pagging : 0);
- $next = (int) $pagging + 20;
- $prev = (int) $pagging - 20;
- $pagination = "";
- //prev button
- if ($pagging > 0)
- $pagination.= '<li><a href="'.base_url().'indeks/index/'.$prev.'" title="prev">Prev</a></li>';
- //next button
- if ($t['end_page'])
- $pagination.= '<li><a href="'.base_url().'indeks/index/'.$next.'" title="next">Next</a></li>';
- $t['pagging'] = $pagination;
- #Menu
- $t['v_menu'] = $this->load->view('template/v_menu',NULL,TRUE);
- #Footer
- $t['v_footer'] = $this->load->view('template/v_footer',NULL,TRUE);
- $this->load->view('pages/v_index' ,$t,FALSE);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement