dqkmn26444 2017-05-05 06:11
浏览 51

如何在Codeigniter中将视图页面与相同的页眉和页脚组合在一起?

I want to create common header and footer that are included on several view pages in MVC.

I'd like to use codeigniter for my project. Most people suggested me to use require_once php function in ci. But, how should I do?

Can Some one give a Step By Step Procedure to include require once in a view file. Through Controller, we can use like the following:-

public function home(){ 
    $this->load->view('templates/header');
    $this->load->view('about');
    $this->load->view('templates/footer');
    }
   public function about(){ 
    $this->load->view('templates/header');
    $this->load->view('index');
    $this->load->view('templates/footer');
    }

How can we do it in view pages in ci using require_once..?

  • 写回答

2条回答 默认 最新

  • doujiao3072 2017-05-05 06:14
    关注

    Controller

    public function home(){
        $this->load->view('index');
        }
       public function about(){
        $this->load->view('about');
        }
    

    Index View

    $this->load->view('templates/header');
    
    // Code of index file
    
    $this->load->view('templates/footer');
    
    评论

报告相同问题?