Creating body ID based on pagetype?

Permalink
Hi,

Is it possible to insert the page type into the body tag based on the active page type being used?

As with the default theme, I've added the top of my template file as an include in elements/header.php, so I suppose one way to do it would be to move the body tag into all my template files, but I'd prefer to keep things clean and just include some php code like 'if active_page_type { echo active_page_type }'

Any ideas? This would give a lot of flexibility in terms of CSS.

Thanks

osu
 
osu replied on at Permalink Reply
osu
Is this something no one has had experience with? Or is it not possible to 'echo' out the active page_type handle in a template?

Would be great to know if possible, could be super useful in terms of CSS.

Thanks
ryan replied on at Permalink Reply
ryan
<?= $c->getCollectionTypeHandle(); ?>
<?= $c->getCollectionTypeID(); ?>
<?= $c->getCollectionTypeName(); ?>
osu replied on at Permalink Reply
osu
...are a legend.

Thanks for your help!
vincedelaking replied on at Permalink Reply
vincedelaking
Thanks a lot!
I will playin around with 'header include' but offcource that will insert a body id into the header tag which wil make messy html.
This works like a charme.