Passing common title to all view and models CodeIgniter

前端 未结 3 724
轻奢々
轻奢々 2021-01-26 09:09

I have this controller



        
3条回答
  •  -上瘾入骨i
    2021-01-26 09:51

    Before construct function add this:

    public $data = array();
    

    Then in the construct function write:

    $this->data['title']="Somesite";
    

    And finally before load view add this:

    $data = $this->data + $data;
    

    Now you have same $title everywhere.

提交回复
热议问题