<?php 

class Cases extends MY_FrontendController{
    public function __construct(){
        parent::__construct();
    }

    public function index(){
        $data = [
            'required_css'=>true,
            'css_file'=>'public/static/front/css/cases.css',
            'nav_active' =>'cases',
            'use_banner' => false,
            'use_breadcrumb' =>true,
            
        ];
        $breadcrumb['main'] = [
            'name' => "成功個案分享",
        ];
        $data = array_merge($data,$breadcrumb);
        $this->load->model("Success_cases_Model");
        $cases = $this->Success_cases_Model->get_partial(0,4);
        $paging = $this->Success_cases_Model->get_no();
        $data['cases'] = json_decode(json_encode($cases),true);
        $data['paging'] = $paging;
       
        $this->view('front/cases',$data);
    
    }

    public function list_record(){
        $post = $this->input->post();
        $get = $this->input->get();
        //var_dump($post);
        //var_dump($get);
        $start = $get['index'] *4 ;
        $length = 4;
        $this->load->model("Success_cases_Model");
        //$result = json_decode(json_encode($this->Success_cases_Model->get_partial($start,$length)),true);
        $result = (json_encode($this->Success_cases_Model->get_partial($start,$length)));
        
       // var_dump($result);
        echo $result;
    }

   
}