If you want to have a different name in every action
Then just set the value CController.pageTitleinside your action:
class MyController extends CController {
public function actionIndex() {
$this->pageTitle = "my title";
}
}
If you want to split a specific title between several actions
One way is to simply follow the above approach, possibly using a class constant as the page name:
class MyController extends CController {
const SHARED_TITLE = "my title";
public function actionIndex() {
$this->pageTitle = self::SHARED_TITLE;
}
public function actionFoo() {
$this->pageTitle = self::SHARED_TITLE;
}
}
, , " ". , , filter. :
class MyController extends CController {
public function filters() {
return array('setPageTitle + index, foo');
return array('setPageTitle - foo');
}
public function filterSetPageTitle($filterChain) {
$filterChain->controller->pageTitle = "my title";
$filterChain->run();
}
public function actionIndex() {
}
public function actionFoo() {
}
}
, :
class MyController extends CController {
public $pageTitle = "my title";
public function actionIndex() {
}
public function actionFoo() {
}
}