Zend 框架 - 如何将变量传递给模板?

Zend framework - how to pass variable to the template?

在 ZF2 中,如何将变量传递给以下 template.phtml?

例如,我在主页中加载 template.phtml 如下:

<?=$this->render("layout/forms/template");?>

其中 template.phtml 有以下代码,但我需要在此处的模板中打印一些内容:<?=$this->????????;?> 通过传递以下值:<?=$this->render("layout/forms/template");?>

<h1 class="free-trial-title">More Information: <?=$this->????????;?></h1>
<section class="free-trial-form">
  <input type="text" name="txtName" id="txtName"  placeholder="Full Name"/><em>*</em><br/>

  <a class="read-more" id="btnContactMoreInfo" nohref>SUBMIT</a>  

</section>

我怎样才能将主页的值传递给那个template.phtml?

如果将附加视图渲染为局部视图,应该没有问题。

<?php echo $this->partial('partial.phtml', array(
    'from' => 'Team Framework',
    'subject' => 'view partials')); ?>

来源: http://framework.zend.com/manual/current/en/modules/zend.view.helpers.partial.html