Forum
How do you get Collection content into Page Title
I am currently using this code for the global header, however what needs to go in to get the 'make' field from my 'make' collection if I am on a Make page?
if (perch_layout_has('blog-post')) {
perch_blog_post_meta(perch_get('s'));
}
elseif (perch_get('cat')) { echo '<title>';
perch_blog_category(perch_get('cat'));
echo ' Car Leasing Blog</title>';
}
elseif (perch_get('tag')) { echo '<title>Articles tagged with ';
perch_blog_tag(perch_get('tag'));
echo '</title>';
}
elseif (perch_get('make_slug')) { echo '<title>';
???????????
echo ' Car Leasing</title>';
}
else{
echo '<title>' . perch_pages_title(true) . '</title>';
perch_page_attributes(array(
'template' => 'seo.html'
));
}
I figured it out :)
If there is a better or cleaner way let me know! :)
What's the purpose of the
perch_get()
around theperch_collection()
?It didn't seem to work when I tried it initially, I'll try it again without :)
Ok stripped that out now, works fine still. I was scratching my head about it earlier as I kept getting a blank page.
Code now: