Call current controller / method in CodeIgniter dynamically
// call current class
$this->router->class;
// call current method
$this->router->method;
USAGE
When loading a view from the controller instead of hardcoding your views names. you can do something like
$this->load->view("{$this->router->class}/{$this->router->method}");
Written by Pedro Luz
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#