xot*_*tix 4 php zend-framework view helper
我必须使用zend框架为一个非常大的应用程序添加一个功能.
我有一个观点.在该视图中,我有一个if并希望在同一位置包含另一个.phtml.
所以,此刻我得到了类似的东西
if (x = true)
require_once(the other file);
Run Code Online (Sandbox Code Playgroud)
这有效,但不是zend的意思.我被告知我应该使用视图助手,更具体,部分.那么,我如何包含部分的phtml文件?我不懂.
Arn*_*anc 12
render()像这样使用视图助手:
<?=$this->render('the other.phtml')?>
Run Code Online (Sandbox Code Playgroud)
当前.phtml脚本中可用的所有视图变量也将可用the other.phtml.
如果要使用特定视图变量呈现其他视图脚本,请partial改用:
<?=$this->partial('the other.phtml', array(
'var'=>'value',
'var2'=>'value2',
...
))?>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11959 次 |
| 最近记录: |