Page Title In Cgridview

Hello!

when passing through the pages CGridView - title page does not change and remains as the main, which is bad for search engines. How to change the title in this case?

by using javascript in afterAjaxUpdate





afterAjaxUpdate=>'function(){document.title = "new title.";}';



afterAjaxUpdate not suitable for this case. because it works if you turn the pages in the table, but if you open the page in a new browser window that titles stand as well as on the main

in this case it sends a get parameter with page number you can use that parameter and setPageTitle() method of controller to set the new title.




$this->setPageTitle('new title');




if (!empty($_GET['page']))

{

$this->setPageTitle("Страница номер ".$_GET['page']);

$this->pageDescription = "Страница номер ".$_GET['page'];

}

else

{

$this->setPageTitle("Главная страница");

$this->pageDescription = "Главная страница";

}