Answer the question
In order to leave comments, you need to log in
What is the correct twig main layout for Yii2 basic?
When connecting the template engine to yii2, there were questions about the main layout
Default example
{{ register_asset_bundle('app/assets/AppAsset') }}
{{ void(this.beginPage()) }}
<!DOCTYPE html>
<html lang="{{ app.language }}">
<head>
<meta charset="{{ app.charset }}">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ html.encode(this.title) }}</title>
{{ html.csrfMetaTags | raw }}
{{ void(this.head) }}
</head>
<body>
{{ void(this.beginBody()) }}
....
{{ void(this.endPage()) }}
{{ this.endPage()|raw }}
{{ this.endPage() }}
// line 1
$this->env->getExtension('yii2-twig')->addUses("yii/web/JqueryAsset");
echo "
";
// line 2
$this->env->getExtension('yii2-twig')->registerAsset($context, "jquery_asset");
echo "
";
Answer the question
In order to leave comments, you need to log in
Line breaks appeared most likely due to the fact that you added them to some included php file before <?php or after ?>, for example, in the controller. I won’t tell you about twig because I don’t use it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question