I've been trying to implement this for a while now, but can't come up with a satisfactory solution.

I want to use the taxonmy block to only appear on nodes that are part of the taxonomy associated with that block. Is there any easy way of doing this? I've currently been adding nodes manually which certianly isn't ideal.

Any ideas are greatly appreciated.

Thx.

Comments

jeepfreak’s picture

I thought the taxonomy id was loaded in the $node array, but maybe not. You could always look it up by node id and then use an if($taxid = 11){ type function surrounding the block. It shouldn't be too hard. How good are you at this stuff?
Billy

mscullen’s picture

Thanks for the quick response... unfortunately that's a little over my head; I'm not a programmer and don't know where to begin to follow your suggestion.

If would wouldn't mind explaining a bit further, I'd be appreciative.

jeepfreak’s picture

I think this code will work, but I have not tested it. You can add all the cases you want in the same way that I did. Just make sure you replace the taxonomy id's with your own.

$sql = "SELECT term_node.tid FROM term_node WHERE term_node.nid = $node->nid";
$results = db_query($sql);
$tax = db_fetch_object($results);
switch($tax){
case 11:

print "something goes here if the taxonomy id is 11";

break;
case 12:

print "something goes here if the taxonomy id is 12";

break;
}

HTH,
Billy

crunchywelch’s picture

Status: Active » Closed (won't fix)

In 4.7 you wil be able to use a php code snippet to display blocks based on whatever check you want the php to do. Check the handbooks for code snippets, or maybe ask in the forums sinc I dont have this code offhand. In any case, we wont add this feature to this module since it will be part of a core drupal funciton. Thanks...