簡體   English   中英

Zend 2.0與Smarty:在.tpl文件上顯示Zend表單

[英]Zend 2.0 with Smarty: display Zend Form on .tpl file

我在Zend 2.0中遇到了麻煩。 我做了一個教程: https : //packages.zendframework.com/docs/latest/manual/en/user-guide/skeleton-application.html ,然后通過以下方式實現了Smarty: Smarty 3如何與Zend Framework 2一起使用? 在.phtml中顯示表單Zend_From看起來像這樣:

$form = $this->form;
$form->setAttribute('action', $this->url('album', array('action' => 'add')));
$form->prepare();
echo $this->form()->openTag($form);
echo $this->formHidden($form->get('id'));
echo $this->formRow($form->get('title'));
echo $this->formRow($form->get('artist'));
echo $this->formSubmit($form->get('submit'));
echo $this->form()->closeTag();

但是如何顯示$this->form i Smarty模板?

解決方法是:

{assign var="form" value=$this->form}
{assign var="attr" value=$form->setAttribute('action', $this->url('album', ['action' => 'add']))}
{assign var="prep" value=$form->prepare()}
{$this->form()->openTag($this->form)}
{$this->formCollection($this->form)}
{$this->form()->closeTag()}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM