php - CodeIgniter: Adding Dynamic Data to Multiple Views -
i'm new codeigniter , have noticed when this:
$data1['title']='new place'; $data2['color']='red'; $this->load->view('header', $data1); $this->load->view('content', $data2);
i can access $title
views/content.php
, did not add $data1
second view.
if that's normal, more efficent add data first loaded view, following?
$data['title']='new place'; $data['color']='red'; $this->load->view('header', $data); $this->load->view('content');
or isn't important (especially when adding lots of data views)?
there's no reason separate data in 2 arrays. 1 array data , sent each view. each view use needed variables. code clearer if split data , there's no difference in resources consumption.
Comments
Post a Comment