I have content types A and B.
I don't want any blocks to show in content type B
In block configure I can see that I will be able to use php for blog visibility.
It warns me that php error may break the site.
Please post php code or any other method to accomplish this.
Your help is urgently needed. Thanks

Comments

pbarnett’s picture

Hi.

How are your content types defined?

It may be easier to disable regions (such as sidebars) rather than blocks for a particular content type, rather than doing it for each block...

Pete.

cog.rusty’s picture

This should do:

$types = array('page', 'blog', 'TypeB');  // put your allowed types in here, one or more.
$showit = FALSE;

if (arg(0) == 'node' && ctype_digit(arg(1)) && is_null(arg(2))) {
  $node = node_load(arg(1));
  if ($node && in_array($node->type, $types)) {
    $showit = TRUE;
  }
}
return $showit;

I assumed that "show in content type B" means "show in pages with a full node view of type B", such as "node/35", but not in "node/35/edit".

------

By the way, instead of putting this visibility code in *all* you blocks (you said "I don't want any blocks"), pbarnett's suggestion is worth examining.

moramata’s picture

Thanks cog.rusty and thank you pbarnett. I know how to create a theme for a specific content type. But, how do I create a page for the content type without any blocks. what is the template name for that page? Thanks

cog.rusty’s picture

I am no good at theming, but this might help.

Customizing full page layouts and sections
http://drupal.org/node/46006