In yii2, there is a public $ title ($ this-> title); Where is it created and how to create your own?
2 answers
Goodnight. In the configuration file, set your value to the name parameter
return [ 'language' => 'ru', 'sourceLanguage' => 'en', 'name' => 'Yii2 Developing' // остальные настройки ] - Thanks, I guess I put it wrong. I'm talking about the view, which would give the value of the title through the view - user292806
- I did not understand about the view, what kind of view in question. Add your question to make it clear what you need. If in the bread crumb view, write $ this-> title => 'new_title' - user216615
|
If you need to change the title or any other meta tag, you can change them directly in the view (view) anywhere:
$this->title = 'Your Title'; Or you can use more advanced meta tags.
$this->registerMetaTag([ 'name' => 'description', 'content' => 'Description of the page...' ]); This can also be realized from the controllers, but for this you need to refer to the application.
public function actionIndex() { Yii::$app->view->title = "test"; Yii::$app->view->registerMetaTag([ 'name' => 'description', 'content' => 'Description of the page...' ]); return $this->render("index"); } |