Note that there are some explanatory texts on larger screens.

plurals
  1. POPerformance and optimization codeigniter
    primarykey
    data
    text
    <p>I wonder which of these two forms is more efficient in Codeigniter. In option 1 the data array is passed to all views. In Option 2 each data array has a different name doing to not forget all the info to each view. I want to assume that Option 2 is correct, I mean rename each array, not spend unnecessary information to each view. Am I correct? Codeigniter or not it matter? Thanks for reading the post regards</p> <p>OPTION 1</p> <pre><code>public function alguna_funcion(){ $data['datos1'] = $this-&gt;modelo-&gt;function1(); $data['widget1'] = $this-&gt;load-&gt;view('widget1',$data,TRUE); $data['datos2'] = $this-&gt;modelo-&gt;function2(); $data['widget2'] = $this-&gt;load-&gt;view('widget2',$data,TRUE); $data['datos3'] = $this-&gt;modelo-&gt;function3(); $data['widget3'] = $this-&gt;load-&gt;view('widget3',$data,TRUE); $data['datos4'] = $this-&gt;modelo-&gt;function4(); $data['widget4'] = $this-&gt;load-&gt;view('widget4',$data,TRUE); $this-&gt;load-&gt;view('home_view',$data); } </code></pre> <p>OPTION 2</p> <pre><code>public function alguna_funcion(){ $data1['datos1'] = $this-&gt;modelo-&gt;function1(); $data['widget1'] = $this-&gt;load-&gt;view('widget1',$data1,TRUE); $data2['datos2'] = $this-&gt;modelo-&gt;function2(); $data['widget2'] = $this-&gt;load-&gt;view('widget2',$data2,TRUE); $data3['datos3'] = $this-&gt;modelo-&gt;function3(); $data['widget3'] = $this-&gt;load-&gt;view('widget3',$data3,TRUE); $data4['datos4'] = $this-&gt;modelo-&gt;function4(); $data['widget4'] = $this-&gt;load-&gt;view('widget4',$data4,TRUE); $this-&gt;load-&gt;view('home_view',$data); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload