A
A
Arthur_S2019-08-27 17:31:35
Yii
Arthur_S, 2019-08-27 17:31:35

How to load menu and footer on different pages?

Cheerful day!
I can guess that the question is from the category of basics, but I am not at all familiar with php (and in general with the server part). There is a task for each page of the site to load a single menu and footer. Doing this by copying the code is suicide, given that several dozen pages are planned, and if there are any changes in the menu and footer (and they certainly will), then again, you will have to change everything manually on each page.
Help me please

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2019-08-27
@Arthur_S

This is a template. Layout https://www.yiiframework.com/doc/guide/2.0/en/stru...

<?php
use yii\helpers\Html;

/* @var $this yii\web\View */
/* @var $content string */
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <?= Html::csrfMetaTags() ?>
    <title><?= Html::encode($this->title) ?></title>
    <?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>
    <header>Моя компания</header>
    <?= $content ?>
    <footer>Моя компания &copy; 2014</footer>
<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question