CI框架,用自定义类库快速前端模板

类库代码:
ci =& get_instance();

    }


    public function excelView($view = '', $data = '')
    {
        $this->ci->load->view ($view, $data );
    }


    public function view($view,$data = []){
        if(!isset($data['base_url'])){
            $data['base_url'] = $this->ci->config->item('base_url');
        }

        $head = $this->ci->load->view('layout/head',$data,TRUE);
        $nav = $this->ci->load->view('layout/nav',$data,TRUE);
        $page = $this->ci->load->view($view,$data,TRUE);
        $array = compact('head','nav','page');
        $this->ci->load->view('layout/template',$array);

    }
}
?>
调用:
public function index()
	{
        $this->load->library('layout');
        $this->layout->view('welcome/index');
	}

你可能感兴趣的:(日常類)