Reputation: 131
how to add parameter in current url in cakephp ?
exemple current url :
http://localhost/testwebsite/posts/index/Search.brand_id:1
I want add parameter and do a link
http://localhost/testwebsite/posts/index/Search.brand_id:1/Search.shop_id:1
Upvotes: 2
Views: 2437
Reputation: 2860
You can create URL like:
echo $this->Html->link('View Page', array(
'controller' => 'page',
'action' => 'view',
'?' => array('Search.brand_id' => 1, 'Search.shop_id' => 1))
);
which will create link like View Page
Upvotes: 2
Reputation: 1120
Try this :
$this->request->query();
Example :
// url array
array('ext' => 'json', '?' => array('foo' => 'bar')
// resulting url
/controller/action.json?foo=bar
$foo = $this->request->query('foo');
// returns "bar" in our example - or null if no foo key is found
Upvotes: 1
Reputation: 539
You can write like below. and get parameter on your function.
$data = $this->params['url'];
http://localhost/testwebsite/posts/index?brand_id=1&shop_id=1
Upvotes: 0