2015-09-26 65 views
1

我在Zend 2.0中遇到了麻烦。 我做了一个教程:https://packages.zendframework.com/docs/latest/manual/en/user-guide/skeleton-application.html 然后我实现了Smarty的是:How can Smarty 3 be Used with Zend Framework 2? 显示窗体Zend_From在一个.phtml看起来是这样的:Zend 2.0与Smarty:在.tpl文件上显示Zend表格

$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我Smarty的模板?

回答

0

解决方法是:

{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()}