douhoulei4706
2015-11-06 10:46
浏览 37
已采纳

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

in ZF2, how can i pass a variable to the following template.phtml?

for example i am loading my template.phtml as following in the home page:

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

where template.phtml has following code, but i need to print something inside that template here: <?=$this->????????;?> by passing value from: <?=$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>

How can i pass the value from home page to that template.phtml please?

图片转代码服务由CSDN问答提供 功能建议

在ZF2中,

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

例如我正在主页中加载我的template.phtml:

 &lt;?= $ this-&gt; render(“layout / forms / template  “);?&gt; 
   
 
 

其中 template.phtml 有以下代码,但我需要在此模板中打印一些内容:< 代码>&lt;?= $ this-&gt; ?????????????? 传递值来自:&lt;?= $ this-&gt; render(“layout / forms / template“);?&gt;

 &lt; h1 class =”free-trial-title“&gt;更多信息:&lt;?= $ this-  &gt; ????????;?&gt;&lt; / h1&gt; 
&lt; section class =“free-trial-form”&gt; 
&lt; input type =“text”name =“txtName”id  =“txtName”占位符=“全名”/&gt;&lt; em&gt; *&lt; / em&gt;&lt; br /&gt; 
 
&lt; a class =“read-more”id =“btnContactMoreInfo”nohref&gt;  SUBMIT&LT; / A&GT;  
 
&lt; / section&gt; 
   
 
 

如何将值从主页传递到该template.phtml?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题