Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // CONTROLLER
- public function index()
- {
- // get pagianation
- $this->load->library('pagination');
- $config['base_url'] = site_url('home/index') ;
- $config['uri_segment'] = 3;
- $config['per_page'] = 3;
- $config['total_rows'] = $this->mdl_home->record_count_product();
- $this->pagination->initialize($config);
- $page = 4this->input->get('per_page' );//$this->uri->segment(3,0);
- $data['pagination'] = $this->pagination->create_links();
- $data['product'] = $this->mdl_home->tampil_data_product($config['per_page'], $page);
- $this->load->view('view_home', $data);
- }
- ?>
- <!--// MODEL-------------->
- <?php
- defined('BASEPATH') OR exit('No direct script access allowed');
- class Mdl_home extends CI_Model{
- var $tbl_product = 'dt_product';
- public function __construct()
- {
- parent::__construct();
- }
- public function tampil_data_product($limit, $start)
- {
- $this->db->limit($limit, $start);
- $query = $this->db->get($this->tbl_product);
- if($query->num_rows() > 0){
- return $query->result();
- }else{
- return false;
- }
- }
- public function record_count_product()
- {
- $query = $this->db->count_all($this->tbl_product);
- return $query;
- }
- }
- // VIEW
- <div class="tab-pane fade" id="marketplace">
- <div class="padding-gutter">
- <?php
- foreach($product as $data) { ?>
- <div class="col-sm-6 col-md-6 col-lg-4">
- <!-- product -->
- <div class="product-content product-wrap clearfix">
- <div class="row">
- <div class="col-md-5 col-sm-12 col-xs-12">
- <div class="product-image">
- <img alt="194x228" class="img-responsive" src="<?php echo $data->img; ?>">
- <span class="tag2 sale">
- Sale
- </span>
- </div>
- </div>
- <div class="col-md-7 col-sm-12 col-xs-12">
- <div class="product-deatil">
- <h5 class="name">
- <a href="#">
- <?php echo $data->nama_product; ?> <span>Category</span>
- </a>
- </h5>
- <p class="price-container">
- <span style="font-size:14px;">Rp. <?php echo number_format($data->harga,2,",",".");?></span>
- </p>
- <span class="tag2 sale"></span>
- </div>
- <div class="description">
- <p><?php echo $data->img; ?></p>
- </div>
- </div>
- </div>
- </div>
- <!-- end product -->
- </div>
- <?php } ?>
- </div>
- <div class="padding-gutter">
- <div class="text-center">
- <ul class="pagination">
- Halaman : <?php echo $pagination;?>
- </ul>
- </div>
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement