CodeIgniter Forums

Full Version: How do I pass an argument to the index function?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
If I have

class Admin extends MY_Controller {
     public function index($task = NULL)

And a hyperlink that goes to base_url('admin/open/');
It will look for a method or function called open in my Admin controller. 
What if I want it to pass a url segement called open to the Index function? What do I do?
For the link, you could use

Or you need to use URI Routing. That can get troublesome if you have a lot of other admin methods that use the standard URL to controller/method/arg mapping.
You can also use the URI Class segment methods.

CodeIgniter User Guide - URI Class