Hi all,
How to customize the tag <title> in Yii2 as before in Yii1
// Custom <title> Yii1
$this->pageTitle = "my custom title";
Try in Yii2
class SiteController extends Controller
{
public $title;
public function actionAbout()
{
$this->title=Yii::$app->name . " - My Custom title";
return $this->render('about');
}
}
index.php
<!DOCTYPE html>
<html lang="<?php echo Yii::$app->language;?>">
<title><?php echo Html::encode($this->title);?></title>
<head>
...
...
</html>
But not working.
Thanks!