Zend布局占位符去哪里



我已经阅读了这篇关于占位符的文章。以前,我在视图脚本中包含一堆文件。经过一段时间,这变得复杂,因为我不得不考虑上下文并且没有一个真正好的解决方案。

我猜这就是占位符的用武之地。我已经阅读了zend文章。我读过的文章都没有非常具体地说明我在哪里放置占位符。他们应该进入哪个文件夹?

原谅我仍然对zend感到非常困惑。

基本上,您将在控制器/视图中的某个位置捕获一个块,然后将其显示在模板/布局中。

我认为这个Zend Doc的例子更有意义。

// 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') ?>

最新更新