Codeigniter view within a view

I'm calling a view into a view. Am I doing correctly, or is this a bad practice?

<div class="tab-pane" id="tab_1_2">
<div class="portlet ">
<div class="portlet-title">
<div class="caption">
<i class="icon-reorder"></i> Nuevo Usuario
</div>
</div>
<?php $this->load->view('modules/user/form_add_user'); ?> </div> </div>  1 Answer For your controller, a method like this would be best to call all your variables: $data = array(
"add_user" => $this->load->view('form_add_user'), "username" =>$username,
"admin"    => $admin );  (Variables are made up just for example) Then, within your code, do this: <div class="tab-pane" id="tab_1_2"> <div class="portlet "> <div class="portlet-title"> <div class="caption"> <i class="icon-reorder"></i> Nuevo Usuario </div> </div> <?=$add_user;?> <!-- looks cleaner -->
</div>
</div>

• form_add_user is a large html form and I placed in another view for that reason. – AndreFontaine Jan 30 '14 at 16:07
• Completely re-wrote answer after some research + your comment @AndreFontaine – Albzi Jan 30 '14 at 16:11