In a relatively heavy function that I want to keep in the same function.
Basically before a $_POST
function I have the view loaded. and after the function I have a different view.
However the same view as before is also showing, only pushed down below the new view, even though I am simply calling the one view.
Is there something like $this->unload->view
?
There is no unload
method in CodeIgniter.
You should consider rewriting your code as it's not correct in any way if you want that functionality. The loaded views are passed to the output almost immediately. The only thing you can do is return the view to some variable for later use:
$stored_view = $this->load->view('my_view', $data, true);
then you can use it in conditionals.
In any case, I am completely sure you are doing something wrong here. Post more description of what you are trying to achieve and the related code so that community could help you.
No need:it's simple
if($_POST)
$this->load->view('view1');
else
$this->load->view('view2');
that's it.....or you wish to give same view but diff parameters then you keep data for post relatively...you can
$data['general'] = 'Main';
if($_POST)
$data['for post'] = 'something';
$this->load->view('comman_view',$data);