我读过这篇关于占位符的文章。以前,我在我的视图脚本中包含了一堆文件。经过一段时间后变得复杂,因为我不得不考虑上下文,而且没有一个非常好的解决方案。
我猜这是占位符进来的地方。我已经阅读了zend article。我读过的所有文章都没有具体说明我放置占位符的位置。他们应该进入什么文件夹?
原谅我,我仍然对zend感到困惑。
答案 0 :(得分:1)
基本上你会在控制器/视图中的某个地方捕获一个块,然后你会在模板/布局中显示它。
我认为这是Zend Doc example makes more sense。
// before the view is displayed
// you can use other methods to render the templates into placeholder for later use
<?php $this->placeholder('foo')->set("Some text for later") ?>
// most like somewhere in the view
<?php
echo $this->placeholder('foo');
// outputs "Some text for later"
?>
or
<?= $this->placeholder('sidebar') ?>