开发者

why the same $data array is passed to all views at the same time in codeigniter if i use template library created by phil?

why the same $data array is passed to all views at the same time in codeigniter if i use template library created by phil?

here is my code in my controller :


    $data['kutta'] = 'Kutta'; // i tried $data = array('kutta' => 'Kutta');
    $this->template->title('Blog', $title)
              ->set_layout('default')
              ->set_partial('header', 'jquery/table/sort_order',$data)
              ->build('jquery/notification/notification',$data);

actually when i pass the $data array only and only to my partial view then the view generated by build() also have the values and variables of $data array given to my partial and vice versa. simply whatever $data array i pass to any of my view is become available to all the 开发者_开发知识库views, why it is happening? you may found the phil's template library here : http://getsparks.org/packages/template/show thanks in advance?


I'm not sure what the question is but there is nothing wrong with the code you posted.

The idea is that a partial is a little view fragment that does its own thing. The chances are this will not need ALL of the data for the entire page available. That slows down parsing and increases memory.

IF however you do need it to have the same data, then pass it the same data.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜