creating a master template in CodeIgniter

后端 未结 2 727
闹比i
闹比i 2021-01-06 14:33

I am stuck with a very basic problem. Ook the problem is this that I want a master template in which I can call the header, body and footer. I am unable to send title and cs

2条回答
  •  心在旅途
    2021-01-06 15:21

    You don't have to pass $data again in your default template.

    
        load->view('templates/header'); ?>
        
            load->view('login/index'); ?>
        
        load->view('templates/footer'); ?>
    
    

    This should allow you to pick up the $title and $css variables in your header as you have got currently.

    With regards to sending multiple css files, create an array of files, like:

    $data['cssFiles'] = array(
        'login-box.css',
        'other.css'
    );
    

    And modify the code in your header to be:

    foreach($cssFiles as $cssFile) {
        
    }
    

    Hope that helps...

提交回复
热议问题