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 Index extends CI_Controller {
- public function __construct()
- {
- parent::__construct();
- $this->load->model('m_produk');
- $this->load->helper(['url','html','form']);
- $this->load->database();
- $this->load->library(['form_validation','session','pagination']);
- }
- public function index()
- {
- $this->load->database();
- $jumlah_data = $this->m_produk->jumlah_data();
- $this->load->library('pagination');
- $config['base_url'] = base_url().'http://localhost/rumah/index';
- $config['total_rows'] = $jumlah_data;
- $config['per_page'] = 10;
- $from = $this->uri->segment(3);
- $this->pagination->initialize($config);
- $data['produk'] = $this->m_produk->data($config['per_page'],$from);
- $this->load->view('account/v_dashboard',$data);
- }
- public function deskripsi($id){
- $rules = [
- [
- 'field' => 'caption',
- 'label' => 'Caption',
- 'rules' => 'required'
- ],
- [
- 'field' => 'description',
- 'label' => 'Description',
- 'rules' => 'required'
- ]
- ];
- $this->form_validation->set_rules($rules);
- $image = $this->m_produk->find($id)->row();
- if ($this->form_validation->run() == FALSE)
- {
- $this->load->view('produk/deskripsi',['image'=>$image]);
- }
- }
- }
- //controller
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement