By bgt on
Ok, basically I'm attempting to have blocks only show up on certain nodes; I can accomplish that at the moment by specifing the specific nodes; but the problem is; I have to keep updating the list everytime I add new content. I wanted to know is their anyway I can associate blocks with terms so that the block will only show if the node is categorized under the term.
Comments
Yes there is … if you know
Yes there is … if you know PHP a bit :-)
In “Page specific visibility settings” for block, you should choose “Show if the following PHP code returns TRUE (PHP-mode, experts only).”
And enter following code:
In $term_ids array you should enter the ids for which block should be visible. I coded this script pretty fast but I think it will do what you want. It will show the block only on node pages and only if node belongs to one of the terms from the $term_ids array.
Hope I helped
Misha
www.byteout.com
You can recognize truth by
its beauty and simplicity.
When you get it right, it is
obvious that it is right.
Richard Feynman, Scientist
I don't have the option of
I don't have the option of "if this php code is true" under "Page specific configuration settings". I only have the following two radio buttons; "Show on every page except the listed pages" and "Show on only the listed pages".
Oh, it seems that it’s a
Oh, it seems that it’s a Drupal 4.7 feature, I guess you’re still on 4.6.
Nevertheless you could still use my snippet, look here for pointers: http://drupal.org/node/47916
I used of the following code
I used of the following code to display a block only on forum nodes:
But it dosen't worked. Are you have any idea?
I myself found the solution.
I myself found the solution. Maybe others are interested I put the code here:
Cheers
Thanks for this code,
I'm trying to have the block also print on the front page. Can any of you tell me what might work? I've tried the following code:
This still works for my 'page' nodes, though.
Thanks in advance.