这适用于 Kohana 2.3.2
我最近开始让我的观点更有活力。使用默认模板视图作为基础,现在我在控制器中做
$this->template->innerView = new View('article');
然后,在我的中间template.php
,我有
<?php echo $innerView; ?>
在我的页眉和页脚之间呼应文章视图的“胆量”。这很好用,除了我定义的所有变量$this->template
都无法从新视图中访问。我知道我可能会做
$this->template->innerView->title = 'My Title';
但是如果有办法让子视图继承父视图的变量,那就太好了。
有没有?