Undefined variable: category

Par lavangy, il y a 14 ans


j'ai un petit problème sur les liens de ma sidebar suite au tuto 3eme jour pour développer un site
voici le message d'erreur

Missing argument 1 for PostsController::category() [APP\Controller\PostsController.php, line 23]
Undefined variable: category [APP\Controller\PostsController.php, line 25]

function category($category){
       $cat = $this->Post->Category->find('first',array('conditions' => array('slug' => $category)));
        if(empty($cat))
         throw new NotFoundException('Aucune page ne correspond à cet ID');
        $d'posts'] = $this->Paginate('Post',array('type'=>'post','online'=>1,'category_id'=> $cat'Category']'id']));
        $this->set($d);
        $this->render('index');
    }

quelqu'un peut orienté
merci

5 réponses

slyvaan, il y a 14 ans

Tu ne dois pas avoir de category indiquée dans ton url tout simplement.

lavangy, il y a 14 ans

et pourtan je point bien sur category et le slug

slyvaan, il y a 14 ans

Quand tu appelles cette fonction, tu as quoi dans ton url ?

lavangy, il y a 14 ans

Merci slyvaan
j'ai trouvé j'ai juste mis un C majuscule dans ma function afterFind erreur été "'action' => 'Category'" ce qui et faux le bon et 'action' => 'category'.

merci encore tu ma bien aider