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
Did you know?
PHP applications still send a browser full of JavaScript. Hardening the server does not inventory the payment, analytics, and plugin scripts that run after the HTML is delivered.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#