Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/05/2017, 22:53
Avatar de detective_jd
detective_jd
 
Fecha de Ingreso: abril-2011
Ubicación: Salto
Mensajes: 437
Antigüedad: 13 años
Puntos: 6
Reutilizar formularios en CakePhp 2.9.8

Hola a todos, me volví a animar a usar CakePhp, y quería preguntar lo siguiente: ¿Es posible crear hacer que los formularios sean reutilizables?

Intento hacer esto:

Código PHP:
Ver original
  1. Hice este cambio:
  2.  
  3. <?php
  4. /**
  5.  * CakePHP TipoForm
  6.  * @author detectivejd
  7.  */
  8. App::uses('FormHelper', 'View/Helper');
  9. class TipoFormHelper extends FormHelper
  10. {
  11.     private $form;
  12.     function __construct() {
  13.         $this->form = [];
  14.         $this->prepare();
  15.     }
  16.     private function prepare(){
  17.         [COLOR="Red"]array_push($form, $this->create("Tipo", ['novalidate' => 'novalidate']));[/COLOR]
  18.         array_push($form, $this->input("des"));
  19.         array_push($form, $this->end());
  20.     }
  21.     public function show(){
  22.         for($i = 0 ; $i < count($form); $i++){
  23.             echo $form[$i];
  24.         }
  25.     }
  26. }

Me da este error:

Call to a member function here() on null
en la línea que puse en rojo.

¿Cómo podré solucionar esto? espero sus respuestas y saludos.

PD: Pongo el link de la imagen -> http://imgur.com/a/bsAeZ