Reputation: 453
development03/carts/listview/cat_id:5
I want to receive the cat_id, which is 5. I am using $this->params['catId']) to get the cat_id. However, i got this error below
Notice (8): Undefined index: catId [APP/controllers/categories_controller.php, line 384]
Controller
function getCategoryName() {
Debugger::dump($this->params['catId']);
return $this->Category->find('all', array('conditions'=>array('Category.id' => $this->params['catId'] )));
}
View
<?php
$categories = $this->requestAction("/categories/getCategoryName");
foreach ($categories as $category) {
echo $category['Category']['name'];
} ?>
Any ideas?
Upvotes: 2
Views: 2221
Reputation: 60594
I think you are looking for $this->params['named']['catId']
EDIT:
Apparently, in cakephp 1.2, it's $this->passedArgs['catId']
From the docs
Upvotes: 3