4

CakePHP 2.2.3

I have something like this:

$this->Html->link('here',
      array(
        'controller' => 'biz',
        'action' => 'search',
        'range' => '1+3'),
      array('escape' => false));

When I click on this link the url will be encoded like this:

/biz/search/range:1%2B3

But I need

/biz/search/range:1+3

Is there any way to switch off url encoding or should I change my controller which parses the named parameter??

1
  • 1
    you can decode the parameter in the corresponding controller. Commented Dec 4, 2012 at 13:59

2 Answers 2

1

Try using:

    $this->Html->link('here',
      array(
        'controller' => 'biz',
        'action' => 'search',
        'range' => '1\+3'),
      array('escape' => '\'));
Sign up to request clarification or add additional context in comments.

1 Comment

You can't do it in the controller. I tested the code above and works fine.
0

Simply can you try this

//search.ctp
echo $this->Html->link('here', '/biz/search/range:1+3');

Receive this in controller

 //BizController.php
 public function search() {
    var_dump($this->request->params['named']);
    // do something     
 }

1 Comment

Where as this works, it fits better with the CakePHP framework to use that array syntax

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.