Shimsham84 Shimsham84 - 6 months ago 28
PHP Question

_remap or URI Routing in codeigniter

I am currently looking into the PHP Framework Codeigniter and understand the main concepts so far until the Controllers section about _remapping. I have a understanding how _remapping overwrites the behaviour of controller methods over the URI eg from to What i would like to hear is peoples opinions on what to use- _remapping method or the URI Routing method? Im only asking this as when researching these methods and someone has been troubled on remapping functions, they have been directed to use URI Routing.


1) What is the main common method to use and the pro's over the other one?
2) Is it best to use URI Routing for PHP5 CI version 2 onwards?

I would be grateful to hear your opinions!

Answer Source

Assuming you do not want to use the index (i.e. action of your Categories controller, you can use routes.

$route['category/(:any)'] = 'category/view/$1';

Then you simply need a View action within your Category controller to receive the Category name, i.e. PHP.

function View($Tag)

Should you still want to access your index action within your controller, you can still access it via

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download