function __construct() {
parent::__construct();
App::import('Helper', 'Html');
$this->Html = new HtmlHelper();
App::import('Helper', 'Form');
$this->Form = new FormHelper();
App::import('Helper', 'Html');
$this->Html = new HtmlHelper();
App::import('Helper', 'Form');
$this->Form = new FormHelper();
}
//if you overwrite construct method, then u need to add parent::__construct... :D
--
Tilen Majerle
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.--
Tilen Majerle
2010/11/27 piousbox <piousbox@gmail.com>
O, I have it:
class TextHelper extends AppHelper {
var $helpers = array('Html', 'Form');
and it works, both $this->Html and $this->Form. But when I try to
test, and test only, then the Form helper inside TextHelper, but not
Html helper, triggers the error, and only while testing. Perhaps a bug
with cake.
So then I did this in my helper:
function __construct() {
App::import('Helper', 'Html');
$this->Html = new HtmlHelper();
App::import('Helper', 'Form');
$this->Form = new FormHelper();
}
And it still doesn't work. The Html works and Form doesn't.
I don't want to debug my debugging code more than the time I spend
writing the actual code...
\V
> Tilen Majerlehttp://majerle.eu
On Nov 26, 2:55 pm, Tilen Majerle <tilen.maje...@gmail.com> wrote:
> u need to use *var $helpers = array("list", "of", "helpers");* in helper
> class which helpers will helper use :D
>
> i think this is problem...
> --
>
> 2010/11/26 piousbox <pious...@gmail.com>
>> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > I get this while testing. Here's my test code:
>
> > function testLogin_register() {
> > $actual = $this->Text->login_register();
> > }
>
> > and the helper code that's being tested:
>
> > function login_register($user = false) {
> > // ...
> > $out = '';
> > $out .= $this->Form->create('User', array('url' =>
> > array('controller' => 'users', 'action' => 'login')));
> > $out .= $this->Form->input('User.username', array('label'
> > => false));
> > $out .= $this->Form->input('User.password', array('label'
> > => false));
> > $out .= $this->Form->end('Login');
> > // ...
> > return $out;
> > }
>
> > So basically that I use $this->Form inside my helper results in an
> > error (but using $this->Html doesn't). Does anyone have an idea why
> > so?
>
> > \V
>
> > with their CakePHP related questions.> > cake-php+unsubscribe@googlegroups.com<cake-php%2Bunsubscribe@googlegroups.com>For more options, visit this group at
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> >http://groups.google.com/group/cake-php?hl=en
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment