get url from a controller and method |
Hello,
Is posible get url from a controller and method Something like this: file routes.php $route['blog/from/controller/home'] = 'ControllerName/Home'; And anywhere controller $url = $this->router->get_url('ControllerName','Home'); echo $url; //exit must be "blog/from/controller/home"
Maybe this will help you:
PHP Code: if (file_exists(APPPATH.'config/routes.php')) You can determine which controller/method is assigned to which route: PHP Code: $find = 'ControllerName/Home'; If you're working with different config.php files for different environments, the code will need a little more tweaking. Take a look at the system/core/Router.php file.
Check URI library. Maybe
PHP Code: $this->uri->uri_string(); or PHP Code: $this->uri->ruri_string(); could work for you.
This was the exact problem that I was facing. I called it named routes.
I have created a infrastructure for it to work, may be you can check and see if it is the right solution or not. Here is the link : https://github.com/aajiwani/LaravelRouti...odeIgniter |
Welcome Guest, Not a member yet? Register Sign In |