How to Deal With Codeigniter Templates?

前端 未结 12 1893
梦谈多话
梦谈多话 2020-12-08 01:02

I\'m fairly new to MVC, and I\'ve found CodeIgniter recently. I\'m still learning everyday, but one problem is its template engine. What is the best way to create templates

12条回答
  •  甜味超标
    2020-12-08 01:37

    I've tried several ways to do codeigniter templates and the way that I stay is the fastest and simplest, is as follows.

    In controller:

        //Charge the view inside array
        $data['body'] = $this->load->view('pages/contact', '', true);
    
    
        //charge the view "contact" in the other view template
        $this->load->view('template', $data);
    

    In view template.php:

     
     
        Template codeigniter 
     
     
        
    Footer

    $body is the view contact.

提交回复
热议问题