Controller
Código PHP:
<?php
class AlbumController extends Zend_Controller_Action
{
public function init()
{
}
public function indexAction()
{
$table = new Application_Model_DbTable_Album();
$this->view->datos = $table->listar();
}
public function addAction()
{
$form = new Application_Form_Album ();
$this->view->form = $form;
}
}
Form
Código PHP:
class Application_Form_Album extends Zend_Form
{
public function init()
{
$username = new Zend_Form_Element_Text("username");
$submit = new Zend_Form_Element_Submit("submit");
$this->setAction("/test.php");
$this->setMethod("get");
$this->addElements(array($username, $submit));
$this->setDecorators(array(
array('ViewScript', array(
'viewScript'=>'/album/add.phtml'
))
));
}
}
Código PHP:
<?php echo $this->form; ?>