Sign up ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

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>
share|improve this question
up vote 2 down vote accepted

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>
share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.