<?php require_once '_toolkit/main.php'; if ($_POST) { echo 'post'; } else { $form = cmp::noticias()->form(); //$form->addField(new Field('email', 'email', NULL, NULL, array('validate' => true))); $form->field('titulo')->type = 'email'; //$form->field('titulo')->validateInput(true); //VALIDA EL CAMPO TITULO SOLAMENTE $form->validate(true); //VALIDA EL FORMULARIO COMPLETO SI HAY UN CAMPO QUE SEA VALIDABLE echo $form; }
<?php require_once '_toolkit/main.php'; $articulos = cmp::noticias()->forEachRow(function ($articulo) { echo $articulo->titulo; });
$noticia->update(); //ACTUALIZA EL REGISTRO NO LA TABLA. echo $noticia; /*--------------------*/ $form = $noticia->form(); //TRAE EL FORMULARIO DEL REGISTRO. $form->addField(new Field('Penultimo')); $form->addField(new Field('Ultimo')); $form->prepend(new Field('Primero')); $form->addFieldAfter('Primero', new Field('Tercero')); $form->addFieldBefore('Tercero', new Field('Segundo')); $form->addFieldAt(4, new Field('Cuarto', 'select', array(1, 2, 3, 4))); /*------------------*/ $form->popField(); $form->removeField('Penultimo'); $form->removeFieldAt(4); //$form->sortFields(); /*------------------*/ echo new Field('what'); //IMPRIME UN FORM INPUT NUEVO QUE NO PERTENECE A NINGUN FORMULARIO. echo html::hr(); echo html::h3('Update Form'); echo $form; echo html::hr(); echo html::h3('Insert Form'); echo cmp::noticias()->form(); //TRAE EL FORMULARIO DE LA TABLA. /**-------------------------------------------*/ /*while ($noticia = $cmp::noticias()->whileFetch()) { echo $noticia->titulo; }*/