1

I would like to use hyphens in my URLs, but since controllers are classes and actions are methods, they of course cannot have hyphens in them. I think for example that about-us looks a lot better in a URL than about_usor aboutus.

Is there a good and clean way to make this happen in Kohana 3.2?

Note: I've seen how you can do this with action parameters, and for that you can just make a route with regex allowing those. But I'm talking about controller and action names here.

Mat
  • 202,337
  • 40
  • 393
  • 406
Svish
  • 152,914
  • 173
  • 462
  • 620
  • 1
    possible duplicate of [How to have URLs with dashes in Kohana 3.x](http://stackoverflow.com/questions/7303889/how-to-have-urls-with-dashes-in-kohana-3-x) – laurent Oct 30 '11 at 11:22
  • That's about dashes in parameters. I'm talking about controller and action names. – Svish Oct 30 '11 at 11:36
  • No, what you want (and you wrote it) is "hyphens in your URLs". Controller and action names obviously cannot have dashes since they are PHP class and function names. – laurent Oct 30 '11 at 11:52
  • Another question here - http://stackoverflow.com/questions/7404646/kohana-3-2-how-can-i-use-hyphens-in-uris/7469890#7469890 – laurent Oct 30 '11 at 11:53
  • @Laurent: No, what I want is what I asked for in my question. "hyphens in controller and action names". And like I said in my very first sentence, I do know that they obviously can't have hyphens in the code since classes and function names do not allow that. And that is the whole reason for me asking this question in the first place :) – Svish Oct 30 '11 at 13:50

1 Answers1

2

You could use a lambda route or overload the Request::controller() and Request::action() methods.

Darsstar
  • 1,885
  • 1
  • 14
  • 14