[eluser]Ben Edmunds[/eluser]
It is fine to have view logic in your views. So looping through results and echoing variables is normal.
You don't want any business or complex logic in your views.
So for examples if you are querying the users from your database and displaying them in a table your controller would call the model, which would return your users, the controller would store the users in an array like
controller
Code:
$this->load->model('users_model');
$this->data['users'] = $this->users_model->get_active_users();
and lastly the view would display the users
view
Code:
<table>
<tr><td>First Name</td><td>Last Name</td></tr>
<?php foreach ($users as $user):?>
<tr><td><?php echo $user->first_name;?></td><td><?php echo $user->last_name;?></td></tr>
<?php endforeach;?>
</table>