【发布时间】:2012-12-16 20:59:30
【问题描述】:
我不知道如何在没有 Blade 的情况下将几个视图合并到一个部分中。
控制器:
public $layout = 'layouts.template';
action_index{
$this->layout->nest('content', 'view1');
$this->layout->nest('content', 'view2');
}
模板.php:
<?php echo Section::yield('content'); ?>
view1.php:
<?php Section::start('content');?>
div1....
<?php Section::stop(); ?>
view2.php:
<?php Section::start('content');?>
div2....
<?php Section::stop(); ?>
现在 - 它只显示 view2
如何实现这样的目标:
$content = View::make('view1');
$content = View::append('view2'); // append view2 to view1?
$this->layout->with('content', $content);
【问题讨论】:
-
我知道您没有使用 Blade,但请考虑使用它。在那里筑巢很容易。