我无法理解何时使用Layout' 变量以及何时使用View' 变量来获取页面上的页面段。这是他们的Layout包教程的图片($this意味着View到处都是实例):

为什么Navigation和Content段Sidebar作为Layout变量?
$this->layout()->nav;
但是HeadTitle,是直接从 View 中得到的吗HeadScript?HeadStylesheet
$this->headTitle(); // I know that this is a placeholder view helper.
// But this segment of the page logically belongs to Layout.
// and it has to be called smth like view->layout->placeholder
为什么Header和来自于但不是属性的Footer某种partial方法?ViewLayout
$this->partial('header.phtml');
我试图改变它们,两种方式都可以正常工作:
echo $this->nav; // I assigned navigation segment script to the View and it works;
我试图将Footer段脚本分配给Layout它,它也可以工作:
$layout->footer = $footer;
echo $this->layout()->footer; // it also works, it's displayed on the page
任何方式都可以应用于页面上的任何变量。例如,在Navigation段中,我有很多变量要显示,我可以使用两种方式输出它们 - 一个变量 asLayout的属性,另一个变量 saView的属性。
那么正确使用它们的规则是什么?什么时候应该使用View' 变量,什么时候使用 ' 变量Layout?