Click read more to check gist code.
- Create components directory and add Controller.php this will be our intermediary controller to add new functionalities.
- Extend your controllers with our new one.
- Add titleSeparator to params.php.
Check my gist for details:
File: Controller.php
--------------------
view->on('afterRender', function($event)
{
if(!empty(Yii::$app->view->title))
{
Yii::$app->view->title = Yii::$app->name . Yii::$app->params['titleSeparator'] . Yii::$app->view->title;
}
else
{
Yii::$app->view->title = Yii::$app->name;
}
});
}
}
File: index.php
---------------
title = 'test';
?>
File: params.php
----------------
'admin@example.com',
'titleSeparator' => ' – ',
];
File: SiteController.php
------------------------
render('index');
}
}