Answer the question
In order to leave comments, you need to log in
How to load views into yii "content" variable?
The question is as simple as possible, but I just can not understand what I'm doing wrong.
Created a new template in layout, added it to config/wep.php. All OK.
<?php
use yii\helpers\Html;
use app\assets\AppAsset;
AppAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title><?= Html::encode($this->title) ?></title>
<?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>
<div class="wrapper">
<div class="container">
<?= Html::a('Ссылка 1', ['post/index.php']) ?>
<?= Html::a('Ссылка 2', ['admin/index.php']) ?>
</div>
<?= $content ?>
</div>
<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>
<?php
namespace app\controllers;
use yii\web\Controller;
class PostController extends Controller {
public function actionPost()
{
return $this->render('index');
}
}
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question