Ernesto, If you use $myForm in your views and remove the assignment from the beforeRender(), I wouldn't consider this a hack. The hack part comes in when you want to substitute your helper for the existing one. Good luck.
-teh On May 12, 9:12 am, Ernesto <[email protected]> wrote: > thanks a lot for the reply, Treag. > > your solution works but, as the code in post #4, it is a hack or > "fancy logic" as Miles stated. > > the only (???) real solution is: wait for CakePHP update :) > > a real thank to everyone who replied this thread :) > > On 12 Mag, 14:47, Teh Treag <[email protected]> wrote: > > > Ernesto, > > > I'm not sure what you are trying to do exactly. But I am curious > > about feedback on this method; I have used to override the default > > behavior of the formHelper in the past. I know there are other ways > > to provide the functionality that's in this example. > > > I would provide my own class, myFormHelper in this example. > > > <?php > > App::import('Helper','Form'); > > class MyFormHelper extends FormHelper { > > public $default_options=array('label'=>false,'div'=>false)); > > public function input($fieldname,$options=array()){ > > return parent::input($fieldname,am($options,$this->default_options)); > > > } > > ?> > > > Now, there are two ways I use classes like this. When I'm working on > > a new project, I just add 'MyForm' to the helpers list in my > > controllers, and use $myForm->input() in my views. For an existing > > project, I take a different route. For an existing project, I don't > > want to go through all the views and update them to use the new > > helper, so I make mine available with the old name. > > > <?php // Some controller > > public $helpers=array('Html','MyForm'); > > public function beforeRender(){ > > $this->Form =& $this->MyForm; > > } > > ?> > > > Ernesto, would this fit your goals? > > > -teh > > > On May 11, 3:26 am, Ernesto <[email protected]> wrote: > > > > Hello. > > > > is there any way to change FormHelper and HtmlHelper default settings?? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
