hide global block on certain sites

Permalink 2 users found helpful
what would be the smartest way ( and most simple to apply for an editor ) to hide global areas from certain sites;

e.g.: hide breadcrumbs from homepage

nj

njerabek
 
JohntheFish replied on at Permalink Reply
JohntheFish
Create a new page type in your theme that does not have that area.
builtbyjay replied on at Permalink Best Answer Reply
builtbyjay
1) Create a page attribute as a checkbox. Give it a handle of something like 'hide_breadcrumb' and name of 'Hide Breadcrumb'.
2) You can now set this attribute on your pages. Go to the page you want to hide the breadcrumb on and click 'Properties' -> 'Custom Attributes', find and click the 'Hide Breadcrumb' attribute on the left and finally, tick the checkbox when it appears.
3) You can now check for the value of this attribute from your page type as follows:
<?php
if ($c->getCollectionAttributeValue('hide_breadcrumb') !== '1'):
    $a = new GlobalArea('Breadcrumb');
    $a->display($c);
endif;
?>


Sorry if I haven't explained it particularly well, I'm a little bit rushed but that's the basics of it. It's worth saying you can make this attribute appear by default for page types by going to Page Types -> Defaults, then Properties and selecting the attribute there. You can also make it appear in the composer view! So many options.

Hope that's helped.
J.
njerabek replied on at Permalink Reply
njerabek
thanks a lot, that was what i had in mind … your "instructions" are absolutely sufficient, … thank you once more;

nj
DeviantDeer replied on at Permalink Reply
DeviantDeer
I am trying to do this same thing. Do I add the code to home.php? I looked at how to create a custom attribute, but I'm not seeing what I need. Thanks!

http://documentation.concrete5.org/developers/concepts/attributes...
enlil replied on at Permalink Reply
enlil
You would need to add the code to the page type .php file of the page type used where you want the areas to be hidden when the attribute is checked.