in beforeRender() in your app controller also make sure $this->MathCaptcha is available!
On 10 Okt., 17:54, "[email protected]" <[email protected]> wrote: > If i understand correctly you want to set the variable so it is available to > any view. > You can put your code in the AppController.php to achieve just that. > > -flosky > > heohni <[email protected]> schrieb: > > Hi, > > I am working on my default.ctp, where I included an element with an > contact form which is using a captcha code. > On every page, regardless where I am on my project, I can click on the > header contact link and open a popup with my contact form. This > contact link is located in my default.ctp > > But where I have to add now this: > $this->set('mathCaptcha', $this->MathCaptcha->generateEquation()); > to setup the captcha? > > Because now I get a Undefined variable: mathCaptcha [APP\views\elements > \news.ctp, line 11] > And line 11 is the place where I call the > <?php echo $form->input('security_code', array('label' => '<span > class="hint" style="padding-top: 40px;">Anti-Spam:<br /></span>What > is: ' . $mathCaptcha, 'style' => 'width: 20px;margin-top:7px;')); ?> > > I am lost.... > > -- > Our newest site for the community: CakePHP Video > Tutorialshttp://tv.cakephp.org > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help others > with their CakePHP related questions. > > To unsubscribe from this group, send email to > [email protected] For more options, visit this group > athttp://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
