Single Page - setting the pageTitle

Permalink
Another day another seemingly simple thing I cant dig out of the documentation..

How do you set the pageTitle variable when installing a new page as part of a package?

Code:
$pkg = parent::install();
$mySinglePage = SinglePage::add('/dashboard/my_dashboard_page',$pkg);
$mySinglePage->update(array('cName' => 'My Dashboard Page', 'cDescription' => 'My dashboard page description');
$mySinglePage->set('pageTitle', 'Page Title Here'); //not correct at all!!


Where/how to I pass the page title into this? I keep making rapid progress over the complex stuff (awesome by the way) and then get caught up with the basics as there is NO mention of this in the doco's...

Wahhh wahh I know. I dont mean to be critical. If someone who knows could tell me I would be eternally grateful...

mikemiller
 
hutman replied on at Permalink Reply
hutman
Is pageTitle a custom attribute that you created? If so it would be:

$mySinglePage->setAttribute('pageTitle', 'Page Title Goes Here');


If that's not what this is please provide more information.
mikemiller replied on at Permalink Reply
mikemiller
Thanks for your response. It is not a custom attribute no. In the above code the actual page title (as in the meta tag in the page header) is set fine (and I thought this was also passed in as $pageTitle variable) but when I inspect the view file here `concrete/themes/dashboard/view.php` I can see that the dashboard page header uses this same variable. This is code from that file:
<header class="ccm-dashboard-page-header"><h1><?php echo t($pageTitle) ?: ' ' ?></h1></header>


So during my package installation how do I set this attribute/variable of the new single page I am installing so when I visit it the header is populated with a title?
mikemiller replied on at Permalink Reply
mikemiller
Just for some further info I tried using setAttribute but this doesnt appear to be a method of the SinglePage class (same issue as using set)
theneptune replied on at Permalink Reply
theneptune
mikemiller replied on at Permalink Reply
mikemiller
hi again neptune, yeah I have been over that. No where does it show me how I set this variable.. I would have thought the cName variable would be passed in as $pageTitle but clearly not
theneptune replied on at Permalink Reply
theneptune
You have to write in the root controller of package. At the place of pagetitle you write your page title.
$def = SinglePage::add('/dashboard/easy_news/pagetitle', $pkg);
$def->update(array('cName'=>'Pagetitle', 'cDescription'=>t('Easy product manage.')));
mikemiller replied on at Permalink Reply
mikemiller
Hi, yeah exactly what I have done. I have figured out that this needs to be written to the collectionVersions table (which it is) and the cvName value will be used to populate the dashboard tray menu (which it does) but doesnt use the same value on the page unless its a sub page or the default sub page. I am close to figuring it out though thanks for your help again
mikemiller replied on at Permalink Reply
mikemiller
OK the answer is to set the title to be shown actually in the single page header is to set the attribute in the single page controller. In hindsight this makes perfect sense