cara membuat slick js dengan template fashe

Gimana cara menampilkan gambarnya biar sesuai dengan urutan ya ? Ini viewnya masih ngasal

VIEW


<!-- Slide1 -->
    <section class="slide1">
        <?php foreach($slider as $slider) { ?>
        <div class="wrap-slick1">
            <div class="slick1">
                <div class="item-slick1 item1-slick1" style="background-image: url(<?php echo base_url('assets/upload/image/'.$slider->gambar) ?>);">
                    <div class="wrap-content-slide1 sizefull flex-col-c-m p-l-15 p-r-15 p-t-150 p-b-170">
                        <span class="caption1-slide1 m-text1 t-center animated visible-false m-b-15" data-appear="fadeInDown">
                            <?php echo $slider->judul_galeri ?>
                        </span>
                        <h2 class="caption2-slide1 xl-text1 t-center animated visible-false m-b-37" data-appear="fadeInUp">
                            <?php echo $slider->isi_galeri ?>
                        </h2>
                        <div class="wrap-btn-slide1 w-size1 animated visible-false" data-appear="zoomIn">
                            <!-- Button -->
                               Order Sekarang
                        </div>
                    </div>
                </div>
                <div class="item-slick1 item2-slick1" style="background-image: url(<?php echo base_url('assets/upload/image/'.$slider->gambar) ?>);">
                    <div class="wrap-content-slide1 sizefull flex-col-c-m p-l-15 p-r-15 p-t-150 p-b-170">
                        <span class="caption1-slide1 m-text1 t-center animated visible-false m-b-15" data-appear="rollIn">
                            <?php echo $slider->judul_galeri ?>
                        </span>
                        <h2 class="caption2-slide1 xl-text1 t-center animated visible-false m-b-37" data-appear="lightSpeedIn">
                            <?php echo $slider->isi_galeri ?>
                        </h2>
                        <div class="wrap-btn-slide1 w-size1 animated visible-false" data-appear="slideInUp">
                            <!-- Button -->
                                Order Sekarang
                        </div>
                    </div>
                </div>
                <div class="item-slick1 item3-slick1" style="background-image: url(<?php echo base_url('assets/upload/image/'.$slider->gambar) ?>);">
                    <div class="wrap-content-slide1 sizefull flex-col-c-m p-l-15 p-r-15 p-t-150 p-b-170">
                        <span class="caption1-slide1 m-text1 t-center animated visible-false m-b-15" data-appear="rotateInDownLeft">
                            <?php echo $slider->judul_galeri ?>
                        </span>
                        <h2 class="caption2-slide1 xl-text1 t-center animated visible-false m-b-37" data-appear="rotateInUpRight">
                            <?php echo $slider->isi_galeri ?>
                        </h2>
                        <div class="wrap-btn-slide1 w-size1 animated visible-false" data-appear="rotateIn">
                            <!-- Button -->
                                Order Sekarang
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <?php } ?>
    </section>

CONTROLLER GALERI


<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Galeri extends CI_Controller{
  //Load model
  public function __construct()
  {
    parent::__construct();
    $this->load->model('galeri_model');
  }
  //Listing data galeri
  public function index()
  {
  		$galeri = $this->galeri_model->listing();
  		$data = array( 	'title' 	=> 'Data Galeri ('.count($galeri).')',
  						'galeri' 	=> $galeri,
  						'isi' 		=> 'admin/galeri/list'
  					);
  		$this->load->view('admin/layout/wrapper', $data, FALSE);
  }
  // Proses
	public function proses()
	{
		$site = $this->konfigurasi_model->listing();
		// PROSES HAPUS MULTIPLE
		if(isset($_POST['hapus'])) {
			$inp 				= $this->input;
			$id_galerinya		= $inp->post('id_galeri');
   			for($i=0; $i < sizeof($id_galerinya);$i++) {
   				$galeri 	= $this->galeri_model->detail($id_galerinya[$i]);
   				if($galeri->gambar !='') {
					unlink('./assets/upload/galeri/'.$galeri->gambar);
					unlink('./assets/upload/galeri/thumbs/'.$galeri->gambar);
				}
				$data = array(	'id_galeri'	=> $id_galerinya[$i]);
   				$this->galeri_model->delete($data);
   			}
   			$this->session->set_flashdata('sukses', 'Data telah dihapus');
   			redirect(base_url('admin/galeri'),'refresh');
   		// PROSES SETTING DRAFT
   		}
	}
  //Tambah
  public function tambah()
  {
  	//Validation
  	$valid = $this->form_validation;
  	$valid->set_rules('judul_galeri','Judul galeri','required',
            array('required'  => '%s harus diisi'));
  	$valid->set_rules('isi_galeri','Isi galeri','required',
            array('required'  => '%s harus diisi'));
  	if($valid->run()) {
			$config['upload_path']   = './assets/upload/image/';
      		$config['allowed_types'] = 'gif|jpg|png|svg|jpeg';
      		$config['max_size']      = '12000'; // KB
			$this->load->library('upload', $config);
      		if(! $this->upload->do_upload('gambar')) {
		// End validasi
    $data= array( 'title'     		 => 'Tambah Galeri',
                  'error'     		 => $this->upload->display_errors(),
                  'isi'       		 => 'admin/galeri/tambah'
                );
    $this->load->view('admin/layout/wrapper', $data, FALSE);
    //Masuk database
    }else{
    	$upload_gambar = array('upload_data' => $this->upload->data());
	      //Create thumbnail gambar
	      $config['image_library']    = 'gd2';
	      $config['source_image']     = './assets/upload/image/'.$upload_gambar['upload_data']['file_name'];
	      //Lokasi folder thumbnail
	      $config['new_image']        = './assets/upload/image/thumbs/';
	      $config['create_thumb']     = TRUE;
	      $config['maintain_ratio']   = TRUE;
	      $config['width']            = 500;//dalam ukuran pixel
	      $config['height']           = 500;
	      $config['thumb_marker']     = '';
	      $this->load->library('image_lib', $config);
	      $this->image_lib->resize();
	      //End create thumbnail
	      $i = $this->input;
	      //CONTOH BOLEH NULL di simple_login if($this->CI->session->userdata('username')==""){
	      $data = array(  'id_user'          => $this->session->userdata('id_user'),
	                      'judul_galeri'     => $i->post('judul_galeri'),
	                      'isi_galeri'		 => $i->post('isi_galeri'),
	                      'website'      	 => $i->post('website'),
	                      'gambar'       	 => $upload_gambar['upload_data']['file_name'],
	                      'posisi_galeri'    => $i->post('posisi_galeri'),
	                      'urutan'    		 => $i->post('urutan'),
	                      'tanggal_post'     => date('Y-m-d H:i:s'),
	                    );
	          $this->galeri_model->tambah($data);
	          $this->session->set_flashdata('sukses', 'Data telah ditambah');
	          redirect(base_url('admin/galeri'),'refresh');
	      }}
	      //End masuk database
	       $data= array('title'    => 'Tambah Galeri',
	                    'isi'       => 'admin/galeri/tambah'
	                );
	    $this->load->view('admin/layout/wrapper', $data, FALSE);
	    }
   //Edit galeri
	public function edit ($id_galeri)
	    {
	      //Ambil data galeri yang akan diedit
	      $galeri   = $this->galeri_model->detail($id_galeri);
	      //Validasi input
	      $valid    = $this->form_validation;
	      $valid->set_rules('judul_galeri','Judul Galeri','required',
            array('required'  => '%s harus diisi'));
  		  $valid->set_rules('isi_galeri','Isi galeri','required',
            array('required'  => '%s harus diisi'));
	      if($valid->run()) {
	        //Check jika gambar diganti
	        if(!empty($_FILES['gambar']['name'])) {
	        $config['upload_path']     = './assets/upload/image/';
	        $config['allowed_types']   = 'gif|jpg|png|jpeg';
	        $config['max_size']        = '12000'; //Dalam kb
	        $config['max_width']       = '12000';
	        $config['max_height']      = '12000';
	      $this->load->library('upload', $config);
	      if ( ! $this->upload->do_upload('gambar')) {
	      //End validasi
	      $data= array( 'title'    		   => 'Edit Galeri',
	      				'galeri'		   => $galeri,
                 		'error'     	   => $this->upload->display_errors(),
                  		'isi'      		   => 'admin/galeri/edit'
                );
		    $this->load->view('admin/layout/wrapper', $data, FALSE);
		    //Masuk database
		    }else{
		    	$upload_gambar = array('upload_data' => $this->upload->data());
			      //Create thumbnail gambar
			      $config['image_library']    = 'gd2';
			      $config['source_image']     = './assets/upload/image/'.$upload_gambar['upload_data']['file_name'];
			      //Lokasi folder thumbnail
			      $config['new_image']        = './assets/upload/image/thumbs/';
			      $config['create_thumb']     = TRUE;
			      $config['maintain_ratio']   = TRUE;
			      $config['width']            = 360;//dalam ukuran pixel
			      $config['height']           = 360;
			      $config['thumb_marker']     = '';
			      $this->load->library('image_lib', $config);
			      $this->image_lib->resize();
			      //End create thumbnail
			      // Proses hapus gambar
					if($galeri->gambar != "") {
						unlink('./assets/upload/image/'.$galeri->gambar);
						unlink('./assets/upload/image/thumbs/'.$galeri->gambar);
					}
				  // End hapus gambar
			      $i = $this->input;
	$data = array(  	  'id_galeri'		 => $id_galeri,
						  'id_user'          => $this->session->userdata('id_user'),
	                      'judul_galeri'     => $i->post('judul_galeri'),
	                      'isi_galeri'		 => $i->post('isi_galeri'),
	                      'website'      	 => $i->post('website'),
	                      'gambar'       	 => $upload_gambar['upload_data']['file_name'],
	                      'posisi_galeri'    => $i->post('posisi_galeri'),
	                      'urutan'			 => $i->post('urutan'),
	              );
	  $this->galeri_model->edit($data);
	  $this->session->set_flashdata('sukses', 'Data telah diedit');
	  redirect(base_url('admin/galeri'),'refresh');
	  }}else{
      //Edit galeri tanpa ganti gambar
      $i = $this->input;
      $data = array(  	  'id_galeri'		 => $id_galeri,
						  'id_user'          => $this->session->userdata('id_user'),
	                      'judul_galeri'     => $i->post('judul_galeri'),
	                      'isi_galeri'		 => $i->post('isi_galeri'),
	                      'website'      	 => $i->post('website'),
	                      //'gambar'       	 => $upload_gambar['upload_data']['file_name'],
	                      'posisi_galeri'    => $i->post('posisi_galeri'),
	                      'urutan'			 => $i->post('urutan')
	              );
          $this->galeri_model->edit($data);
          $this->session->set_flashdata('sukses', 'Data telah diedit');
          redirect(base_url('admin/galeri'),'refresh');
       }}
      //End masuk database
       $data= array( 'title'    => 'Edit Galeri',
                    'galeri'  	=> $galeri,
                    'isi'       => 'admin/galeri/edit'
                );
      $this->load->view('admin/layout/wrapper', $data, FALSE);
	}
	//Delete galeri
	public function delete($id_galeri)
    {
      //Proteksi delete
      //$this->check_login->check();
     $galeri = $this->galeri_model->detail($id_galeri);
		// Proses hapus gambar
		if($galeri->gambar=="") {
		}else{
			unlink('./assets/upload/image/'.$galeri->gambar);
			unlink('./assets/upload/image/thumbs/'.$galeri->gambar);
		}
		// End hapus gambar
		$data = array('id_galeri'	=> $id_galeri);
		$this->galeri_model->delete($data);
	    $this->session->set_flashdata('sukses', 'Data telah dihapus');
	    redirect(base_url('admin/galeri'),'refresh');
	}
}

GALERI MODEL


<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Galeri_model extends CI_Model {
	public function __construct()
	{
		parent::__construct();
		$this->load->database();
	}
	//Listing all galeri
	public function listing()
	{
		$this->db->select('galeri.*,
						users.nama');
		$this->db->from('galeri');
		//JOIN
		$this->db->join('users','users.id_user = galeri.id_user', 'left');
		//END JOIN
		$this->db->order_by('id_galeri', 'desc');
		$query = $this->db->get();
		return $query->result();
	}
	//Listing slider
	public function slider()
	{
		$this->db->select('galeri.*,
						users.nama');
		$this->db->from('galeri');
		//JOIN
		$this->db->join('users','users.id_user = galeri.id_user', 'left');
		//END JOIN
		$this->db->where('posisi_galeri', 'Homepage');
		$this->db->order_by('urutan','ASC');
		$this->db->limit(5);
		$query = $this->db->get();
		return $query->result();
	}
	// Listing data slider
	public function galeri_home() {
		$this->db->from('galeri');
		// Join dg 2 tabel
		$this->db->join('users','users.id_user = galeri.id_user','LEFT');
		// End join
		$this->db->where('posisi_galeri','Galeri');
		// $this->db->group_by('galeri.id_kategori_galeri');
		$this->db->order_by('id_galeri','DESC');
		$this->db->limit(6);
		$query = $this->db->get();
		return $query->result();
	}
	// Listing data slider
	public function galeri($limit,$start) {
		$this->db->from('galeri');
		// Join dg 2 tabel
		$this->db->join('users','users.id_user = galeri.id_user','LEFT');
		// End join
		$this->db->where('posisi_galeri','Galeri');
		$this->db->order_by('id_galeri','DESC');
		$this->db->limit($limit,$start);
		$query = $this->db->get();
		return $query->result();
	}
	// Listing data slider
	public function total_galeri() {
		$this->db->from('galeri');
		// Join dg 2 tabel
		$this->db->join('users','users.id_user = galeri.id_user','LEFT');
		// End join
		$this->db->where('posisi_galeri','Galeri');
		$this->db->order_by('id_galeri','DESC');
		$query = $this->db->get();
		return $query->result();
	}
	// Detail data
	public function detail($id_galeri) {
		$this->db->select('*');
		$this->db->from('galeri');
		$this->db->where('id_galeri',$id_galeri);
		$this->db->order_by('id_galeri','DESC');
		$query = $this->db->get();
		return $query->row();
	}
	// Tambah
	public function tambah($data) {
		$this->db->insert('galeri',$data);
	}
	// Edit
	public function edit($data) {
		$this->db->where('id_galeri',$data['id_galeri']);
		$this->db->update('galeri',$data);
	}
	// Delete
	public function delete($data) {
		$this->db->where('id_galeri',$data['id_galeri']);
		$this->db->delete('galeri',$data);
	}
}
/* End of file Galeri_model.php */
/* Location: ./application/models/Galeri_model.php */
avatar Exmy31
@Exmy31

28 Kontribusi -1 Poin

Dipost 4 tahun yang lalu

1 Jawaban:

<div>Alhamdulillah dah jadi .Salah penempatan di foreach nya.</div>

avatar Exmy31
@Exmy31

28 Kontribusi -1 Poin

Dipost 4 tahun yang lalu

Login untuk ikut Jawaban