Welcome Guest, Not a member yet? Register   Sign In
Codeigniter routing
#3

[eluser]Pert[/eluser]
Depending on how exactly do you want to set up your URLs, you can use routing file if all your links follow some kind of a standard
Code:
$route['category/(:any)'] = 'category/details/$1';

So URL example.com/category/my-new-category loads controller category and runs method details with single attribute with value 'my-new-category'. From there you can see if that value is in your category table.

You can also use controllers _remap function. If present, when ever controller is called, only _remap function is called. You can check in that method what kind of link it is.

I myself use 404 override in route configuration file for my CMS. If URL does not translate to a meaningful controller, my custom 404 controller tries to figure out, what content is suppose to be shown, and displays it - or if it can't work out URL, it truely is a 404 page.


Messages In This Thread
Codeigniter routing - by El Forum - 06-11-2013, 08:01 AM
Codeigniter routing - by El Forum - 06-13-2013, 05:23 PM
Codeigniter routing - by El Forum - 06-14-2013, 01:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB