【发布时间】:2015-08-15 23:40:32
【问题描述】:
我有关于视图和布局的指南,我已经用谷歌搜索了如何做到这一点,但我仍然无法使其工作。问题来了:
我想要 2column.php 和 3column.php 布局,两者都使用 _header.php 和 _footer.php 部分。
2columns.php 布局示例:
render _header.php
$content and some other extra code
render _footer.php
无论我做什么,我都无法让它发挥作用。有人可以向我发布如何实现这一目标的真实简单示例吗?谢谢
请注意答案:
使用:
<?php $this->beginContent('@app/views/layouts/header.php'); ?>
<!-- You may need to put some content here -->
<?php $this->endContent(); ?>
对我没有帮助...不知道该怎么办,我不能让它做我需要的。
【问题讨论】:
-
您是否尝试过使用 PHP
include 'file.php'包含页眉和页脚文件? -
我希望有一些 Yii2 方式。