ahoy,
i'm trying to implement your component but i've a little issue.
here's my code on CommentController.php
class CommentsController extends AppController {
public $name = 'Comments';
public $helpers = array('Html', 'Form', 'Session');
public $components = array('MathCaptcha','RequestHandler');
public function add($post_id = null) {
$this->set('captcha', $this->MathCaptcha->getCaptcha());
if ($this->request->is('post')) {
$this->Comment->set(array('post_id'=>$post_id));
$this->request->data['Comment']['ip'] = $this->RequestHandler->getClientIp();
if ($this->MathCaptcha->validate($this->request->data['Comment']['captcha'])) {
$this->Session->setFlash("ok.","notif");
$this->redirect(array('controller' => 'posts', 'action' => 'view', $post_id));
} else {
$this->Session->setFlash("ko.","notif");
}
}
}
}
and my view
Form->input('captcha', array('label' => 'Calculate this: '.$captcha)); ?>
but when i refresh i've an error who say:
Notice (8): Undefined variable: captcha [APP\View\Elements\newcomment.ctp, line 13]
(my line 13 is the line before
don't know why sadly ... can you please help me?
ahoy,
i'm trying to implement your component but i've a little issue.
here's my code on CommentController.php
class CommentsController extends AppController {
}
and my view
Form->input('captcha', array('label' => 'Calculate this: '.$captcha)); ?>but when i refresh i've an error who say:
Notice (8): Undefined variable: captcha [APP\View\Elements\newcomment.ctp, line 13]
(my line 13 is the line before
don't know why sadly ... can you please help me?