Reputation: 7358
From 2.5 Migration Guide:
$title_for_layout
is deprecated. Use$this->fetch('title');
and$this->assign('title', 'your-page-title');
instead.
They work in Views, but what to do in Controller? Using $this->assign()
throws Fatal error.
Upvotes: 8
Views: 12676
Reputation: 805
You have to use
$this->assign('title',$title);
in view files.
In layout, You can also use
$this->fetch('title', $title);
to set the title
You can use $this->set('title_for_layout',$title);
but you should not as it will be removed very soon
Upvotes: 5
Reputation: 656
just set this in your controller's function()
$title = 'Title of your page | Site';
$this->set(compact('title'));
then you can use $title in your views to change the title of your page. :)
Upvotes: 4
Reputation: 11693
Use
$this->set('title_for_layout', 'List User');
inside controller.
Upvotes: 7