Forum
Title in the header layout - list / detail page
I have my title field in my header layout
<title><?php perch_layout_var('title'); ?></title>
Then in my list / detail page I am looking to output the page title but its not working this is what I have tried
$title = if (perch_get('s')) {
perch_content_custom('First Team', array(
'template' => 'squad/first_team_title.html',
'filter' => 'slug',
'match' => 'eq',
'value' => perch_get('s'),
'count' => 1,
'skip-template' => 'true',
} else {
echo "First Team";
}
));
perch_layout('global/header', [
'title'=> $title
]);
This is not right, any help would be great
Barry
The only thing this flags is that in the first cast
$title
will be an array, and the second a string. So watch out for that.I'm not sure how to get around this. The list page now works as expected but the detail page is showing this error
Which element from the array do you want?
I just want the Title from the template
So it outputs
Thankyou that worked perfectly. Thanks
Here is the final code for anyone having the same question