控制器中的 Zend 链接按钮元素


zend link button element in controller

我的控制器中有这个按钮,并试图在我的视图 phtml 中将其回显给用户,但它似乎没有返回元素。

按钮

    $button = new Zend_Form_Element_button('button');
    $button->setAttrib('id', 'B!');
    $button->setLabel('Previous');
    $button->setAttrib('onClick', "parent.location='" . Zend_Controller_Front::getInstance()->getBaseUrl() .'/../..' ."'");
$this->view->button = $button;

在我看来

<?php echo $this->button; ?>

您的代码在我的应用程序中工作。

如果你只想要一个按钮,你可以做这样的事情:

在您的控制器中:

$this->view->location = "parent.location='" . Zend_Controller_Front::getInstance()->getBaseUrl() .'/../..' . "'";

在视图中

<input id="B" type="button" value="Previous" onClick="<?php echo $this->location;?>">