Can someone explain Kohana 3's routing system?

I thought that would mean a request like products/something would load up the articles controller, and the action_view_product controller But I can't get it to work You got the bolded part wrong. It will actually load action_view_product method of the articles controller: class Controller_Articles extends Controller { public function action_view_product() { $params = $this->request->param(); // if the uri is `products/something' then $params'type' == 'something' } } EDIT: Oh my god oh your god why didn't I notice! The actual problem lies within your route pattern!

It should have been products/() with the angle brackets. Those will hint Kohana that you intended the 'type' to be a parameter name, instead of a literal.

I thought that would mean a request like products/something would load up the articles controller, and the action_view_product controller. But I can't get it to work. You got the bolded part wrong.It will actually load action_view_product method of the articles controller: class Controller_Articles extends Controller { public function action_view_product() { $params = $this->request->param(); // if the uri is `products/something' then $params'type' == 'something' } } EDIT: Oh my god oh your god why didn't I notice!

The actual problem lies within your route pattern! It should have been products/(), with the angle brackets. Those will hint Kohana that you intended the 'type' to be a parameter name, instead of a literal.

Sorry, that was a typo! I still can't seem to get it to work for me. – alex Jan 19 '10 at 3:07 did you put your controller php file in the correct folder?

– Lukman Jan 19 '10 at 3:10 Yes, I have a default route that is capturing all (and working alright) – alex Jan 19 '10 at 3:12 did you declare this custom route before the default route? Because the routing will match the first route it encounters, and since the default route will match 'products/something', it will take that route. – Lukman Jan 19 '10 at 3:53.

Uff, sorry, lower then and greater then signs doesn't shows correctly 'products/(type)' should be 'products/().

The parentheses indicate optional parts (the regex will match if they are missing). These can be static and/or contain named variables. The angle brackets indicate a named variable in the route which is accessible in the controller via: $this->request->param('type'); I wrote the official routing guide which you can read here, it should answer all of your questions.

Php, where you set routes, I'm having a hard time getting them to work. I read some documentation a while ago that I can't seem to find again that explains them. I thought that would mean a request like products/something would load up the articles controller, and the action_view_product() method.

But I can't get it to work. Can someone please explain to me exactly how they work, and what all the method parameters are?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions