How can I show a block based on the taxonomy term(s) for a Node?

I'd settle for a PHP solution to this, though I feel it should be built into the UI for Block visibility settings.

Thank you,
DUG1138

Comments

rahulbile’s picture

You can create a Block through views module. Where u can show the taxonomy terms by node being viewed.

Cheers

DUG1138’s picture

Thanks, but that's not exactly what I'm trying to do.

I want a Block to be shown or hidden based on the Taxonomy of the Node being viewed.

Say I have Taxonomy IDs 1, 2 and 3 that can be applied to a certain Content Type, say "Test Page".

I want this Block to only be displayed (shown) when a "Test Page" associated with Taxonomy 3 is being viewed, and the Block should not be shown if we are viewing a "Test Page" of Taxonomy 1 or 2.

I've seen examples of doing this in Drupal 4 and 6.

Does anyone know how to do this in Drupal 7?

Thank you,
DUG1138

mamayers’s picture

I installed pathauto, created an alias path (eg. contentXYZ) then I set up blocks to show up by url (contentXYZ/*) and by taxonomy terms aliases (eg. taxonomy-term-name), don't select any content type display mode. It's not very automated because you need to add taxonomy terms in the block every time you make an update but it works fine in D7.

All the best,

Max

skizzo’s picture

you may want to take a look at block_term

iandale’s picture

I was looking to do the same and used the Context module at http://drupal.org/project/context
Does exactly what you want. Work for Drupal 7