CakePHP 1.3 - Extract URL GET parameters

910 views Asked by At

I have CakePHP 1.3.2 application working with similar URLs:

/controller/action/name1:value1/name2:value2.html

I'm trying to extract the values after the : sign specified by the names before that. I can see the whole URL with no problem using $this->params['url'], however, I can't get the value itself using neither $this->params['name1'], nor $this->params['url']['name1']. Any tips?

1

There are 1 answers

0
Ofir Baruch On BEST ANSWER

From the Cakephp 1.3 book:

URL: /contents/view/chapter:models/section:associations Mapping:

ContentsController->view(); $this->passedArgs['chapter'] = 'models';

$this->passedArgs['section'] = 'associations';

$this->params['named']['chapter'] = 'models';

$this->params['named']['section'] = 'associations';

So you should use:

$this->params['named']['name1']
$this->params['named']['name2']