[eluser]xwero[/eluser]
Lets say you have not a lot of code and you put all the things in one controller
Code:
class Accounts extends Controller
{
function index()
{
switch($this->uri->segment(2))
{
case 'delete': /* code */ break;
// ...
default: /* no extra segments */ break;
}
}
function orders() // same structure for images
{
switch($this->uri->segment(3))
{
case 'delete': /* code */ break;
// ...
default: /* no extra segments */ break;
}
}
}
Then you can set up your routing as follows
Code:
$route['account/(delete|other|actions)(.*)'] = 'account/index/$1$2';
And that is the only routing you need because the account/orders will be routed to the correct method by default.
If you want to split the controllers to have smaller files you could go for following file structure
actions/actions.php : the index function in the controller above
actions/orders.php
actions/images.php
And in the routing this will have following result
Code:
$route['account'] = 'account/account';
$route['account/(delete|other|actions)(.*)'] = 'account/account/$1$2';
The cases in the switch become methods.