this is my controller
public function index() {
$this->data['users'] = $this->user_login_model->get();
$this->data['abc'] = 'admin/user/index';
$this->load->view ( 'admin/_layout_main', $this->data);
}
this is my view
<div class="container">
<div class="row">
<!-- main column -->
<div class="col-sm-9">
<?php $this->load->view($abc);?>
</div>
</div>
</div>
this is the error
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: abc
Filename: admin/_layout_main.php
Line Number: 31 An Error Was Encountered
Unable to load the requested file: .php
You can try following:
By this way you can use your view and template in controller function.