I just installed the image module and I want to have it so that when I look at pictures or galleries nothing shows up in my right sidebar block. Currently in that sidebar I have the "recent posts" and "recent comments" and I want to hide those any time I am looking at anything of the node type "image." Is this possible? I have tried changing the exceptions in the specific blocks but had no luck.

Comments

Kuldip Gohil’s picture

Hi
You can use php code acording to argument at the block visibility
settings
Kuldip Gohil

uzbekjon’s picture

I had the same requirement. The first thing that came into my head was to use PHP as a display rule. Here we go:

// URL to hide from: www.example.com/?q=node/20
$nid = arg(1);
if($nid && is_numeric($nid)){
  $node = node_load($nid);
  if($node->type == 'image'){
    return false;
  }
}
return true;

Note: I have not used the image module, so I don't know what is the node type (machine readable name of the node). I just used 'image' here. See in admin panel -> content types for it and change the string in the code accordingly.

Good luck with you project.

-------------------------------
Sites for uzbeks and Uzbekistan:
Uzbek Lyrics Database
Uzbekistan Forum

idcm’s picture

this script rocks
thanks

nimazuk’s picture

I think the best way to do this is using PATHAUTO module.
http://drupal.org/project/pathauto

1- Install the module.
2- Go to configuration page and set up a unique path for node type IMAGE (like photo/[nid])
3- Go to block administration.
4- Set the visibility option of the block to SHOW ON EVERY PAGE EXCEPT PAGES BELOW
5- Write this path in the textarea: photo/*

I am using this for different content types on many sites.

N.Mehrabany
Baruzh web design & programming

Nima

awildey’s picture

Thank you for the fast reply. I set-up PATHAUTO just like you said and it works perfect.

uzbekjon’s picture

God... I always forget about pathauto.

Thanks nimazuk for refreshing my memory. Pathauto goes to my arsenal right away.

Uzbek

-------------------------------
Sites for uzbeks and Uzbekistan:
Uzbek Lyrics Database
Uzbekistan Forum