If you want to emulate the behavior of cake 1.2, you can do the following:
In your app_controller, create the following method:
in app / app_controller.php (you may need to create this file if you havenβt already)
public $pageTitle; public function beforeRender() { $this->set('title_for_layout', $this->pageTitle); }
Then, in any of your action methods, you can use pageTitle, as in 1.2.
public function index() { $this->pageTitle = 'Some Title'; }
The beforeRender () method is called after your controllers have finished processing, but before rendering the layout, which allows you to set variables for the layout.
source share