HOLAS AYUDENMEN ASI TENGO MI PROGRAMA QUIERO INGRESAR 1000 REGISTROS CON UN BUCLE O COMO ME PUEDEN AYUDAR
EN MI MODELO En tarea.php en el <?php class Tarea extends AppModel{ var $name = 'Tarea'; } ?> EN MI CONTROLADOR esto en tareas_controller.php <?php class TareasController extends AppController { var $name = 'Tareas'; var $helpers = array('html', 'Form'); function index() { $this->set('tareas', $this->Tarea->find('all')); } function edit($id = null ){ if (!$id){ $this->Session->setFlash('Tarea Inválida'); $this->redirect(array('action'=>'index'),null,true); } if(empty($this->data)){ $this->data = $this->Tarea->find(array('id'=> $id)); } else{ if ($this->Tarea->save($this->data)){ $this->Session->setFlash('Tarea ha sido salvada'); $this->redirect(array('action'=>'index'),null,true); } else { $this->Session->setFlash('La Tarea no ha sido salvada. Inténtalo de nuevo'); } } } function add() { if (!empty($this->data)) { $this->Tarea->create(); if ($this->Tarea->save($this->data)){ $this->Session->setFlash('La tarea ha sido salvada'); $this->redirect(array('action'=>'index'),null,true); } else { $this->Session->SetFlash('Tarea no salvada. Prueba de nuevo'); } } } function add1() { $this->Tarea->create(); for ($i = 0; $i < 1000; $i++): $this->Tarea->create(); if($this->Tarea->save($this->data)){} endfor; } function delete($id=null){ if (!$id){ $this->Session->setFlash('Tarea Inválida'); $this->redirect(array('action'=>'index'),null,true); } if(empty($this->data)){ $this->data = $this->Tarea->find(array('id'=> $id)); } else{ if ($this->Tarea->delete($id)){ $this->redirect(array('action'=>'index'),null,true); } else { $this->Session->setFlash('La Tarea no ha sido salvada. Inténtalo de nuevo'); } } } } ?> EN MI VISTA Cree una carpeta TAREAS // add.ctp // <?php echo $form->create('Tarea'); ?> <fieldset> <legend>Añadir Nueva</legend> <?php echo $form->input('titulo'); echo $form->input('hecha'); ?> </fieldset> <?php echo $form->end('Añadir Tarea'); ?> <?php echo $html->link('Lista Todas las Tareas', array ('action'=>'index')); ?> // add1.ctp // <?php echo $form->create('Tarea'); ?> <fieldset> <legend>Añadir Nueva</legend> <?php echo $form->input('titulo'); echo $form->input('hecha'); ?> </fieldset> <?php echo $form->end('Añadir Tarea'); ?> <?php echo $html->link('Lista Todas las Tareas', array ('action'=>'index')); ?> AYUDENMEN EN LA PARTE DEL ADD1.CTP COMO DEBO HACER GRACIAS -- Has recibido este mensaje porque estás suscrito al grupo "CakePHP-es" de Grupos de Google. Para publicar una entrada en este grupo, envía un correo electrónico a cakephp-es@googlegroups.com. Para anular tu suscripción a este grupo, envía un correo electrónico a cakephp-es+unsubscr...@googlegroups.com Para tener acceso a más opciones, visita el grupo en http://groups.google.com/group/cakephp-es?hl=es.