I’m moving from Yii 1.1 and I am used to keeping the view files clean of code as much as possible for our front-end developers. They are also used to working in Smarty, so that’s where I’m going with this.
How would I load the following in a controller action?
<?php use yii\helpers\Html; use yii\bootstrap\Nav; use yii\bootstrap\NavBar; use yii\widgets\Breadcrumbs; use app\assets\AppAsset; /* @var $this \yii\web\View */ /* @var $content string */ AppAsset::register($this); $this->title = 'Contact'; $this->params['breadcrumbs'] = $this->title; ?>
Also, can someone explain what the purpose of these?
<?php $this->beginPage() ?> <?php $this->beginBody() ?> <?php $this->endBody() ?> <?php $this->endPage() ?>
Thirdly, is there an easy way to make things available in the view from the controller? I’m used to just making getters in the controller, but now $this is the view instead…