How get the name of the current displaying view for pass to another function?
If you want to display view name within view :
echo $_ci_view;
Also see print_r(get_defined_vars())
you will see many interesting variables from CI.
You could pass the name of the View to the View.
Controller:
$data = array('viewName' => 'home_view');
$this->load->view($data['viewName'], $data);
Then to access in your view you could retrieve the view name with:
<?php echo $viewName ?>
//produces 'home_view'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With