TIP: Use Markdown or, <pre> for multi line code blocks / <code> for inline code.
Forums are in read-only mode while we transition to new software.
Hyphen in URLs - 3.x Request
  • I prefer hyphen (-) in URLs, so I have to replace them before action is called.

    Here's how to do this in 3.0.x

    class Request extends Kohana_Request
    {
        public function execute()
        {
            $this->action = str_replace('-', '_', $this->action);
            return parent::execute();
        }
    }
    

    What is 3.x equivalent?

  • What are the best practices for this?

    Should I overwrite that function, something like this?

    class Request extends Kohana_Request
    {
        public function action($action = NULL)
        {
            $action = str_replace('-', '_', $action);
            if ( ! $action)
                return $this->_action;
    
            $this->_action = (string) $action;
            return $this;
        }
    }
    

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion