Change single page header title via controller or in template

Permalink
Hi,
I am designing a dashboard single page. And as I noticed the header text (the text in grey are and next to bookmark icon: header.ccm-dashboard-page-header) is automatically set equal to the page title.
Is there a way to change this title? Maybe with setting a variable or even adding something in the template file?

 
mnakalay replied on at Permalink Best Answer Reply
mnakalay
In your single page's controller, in the view() function you add
$this->set('pageTitle', t('Your new title here'));
Herkool replied on at Permalink Reply
Thank you mnakalay.
While we are at it, how can I get the current set $pageTitle? I tried
$this->get('pageTitle');
And it doesn't seem to work.
mnakalay replied on at Permalink Reply
mnakalay
No that wouldn't work. What happens is you get to set pageTitle in your page's controller and only later does Concrete5 check if you did or not. If not, it uses the page's name.

So basically, if you want to know what Title C5 would use if you didn't set it yourself, you do
$pageTitle = $this->c->getCollectionName();

$this->c is already set in the controller