でZendのフォーム要素をレンダリングすることができません:私はレンダリングするとき私はこのようなLogin.phpフォーム持ってViewScript
<table>
<tr>
<td><?= $this->getElement('username') ?></td>
</tr>
<tr>
<td><?= $this->getElement('password') ?></td>
</tr>
</table>
/authentication/login-form.phtml
class Form_Login extends Zend_Form {
public function init() {
}
public function __construct(){
// Set method
$this->setMethod('post');
$elements = array();
$element = $this->createElement('text','username');
$element->setRequired(true);
$elements[] = $element;
$element = $this->createElement('password','password');
$element->setRequired(true);
$elements[] = $element;
$this->addElements($elements);
$this->setDecorators(array(array('viewScript', array('viewScript' => '/authentication/login-form.phtml'))));
}
}
をフォームを入力すると、次の例外が発生します。
Message: Plugin by name 'GetElement' was not found in the registry; used paths: Zend_View_Helper_: Zend/View/Helper/;C:/wamp/www/databox/application/views\helpers/
私は間違っている。 application.iniまたはBootstrapに情報を入力する必要があります。
ありがとうございます。
はい、私はsomeActionで同じことをやっているし、フォームをレンダリング** some.phtml **は '$ this-> form-> render();'のようです。しかし、フォーム要素は** login-form.phtml **で表示されるべきだと思います。 – Awan
あなたは、ログインフォームがレンダリングされる関連アクションのないビュースクリプトを持っていますか? –
@Samuel Herzog:私はこれについて知らないし、初めてZendフォームに取り組んでいます。もっと説明してください。ありがとうございました – Awan