Klauzito
Klauzito

Reputation: 31

Codeigniter $route

I have a doubt. In my route, I have something like this:

$route['events(:any)'] = "events/view/$0";

But I need to except one word, in my case 'gallery'.

So, any url with events excepts gallery will route to events/view/$0 and gallery will route to events/gallery

But $route['events(:any)'] can be events-social, or events-corp, or events-indor

How do I do that? Any help will be appreciated.

Upvotes: 0

Views: 305

Answers (1)

Colin Brock
Colin Brock

Reputation: 21575

Since routes are run in the order they are defined, you can simply define a gallery route first:

$route['events-gallery'] = "events/gallery";
$route['events-(:any)'] = "events/view/$0";

Note the added hyphen in events-(:any) in the second route above. Based on the description of what you're trying to achieve, I think you're missing that from your code.

Upvotes: 1

Related Questions