<div dir="ltr">Add "return $make_block_visible;" (without the quotes) as the last line directly above the closing php tag ("?>")<br><br><br><div class="gmail_quote">On Tue, Aug 5, 2008 at 3:39 PM, crozilla <span dir="ltr"><<a href="mailto:crozilla@gmail.com">crozilla@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">All,<br>
<br>
I kinda know what I'm doing in Drupal, but this trick has baffled me.<br>
This is what I want to have happen: When the page has the term 221,<br>
block/24 is visible, when the page doesn't have the term, the block is<br>
disabled. Sounds simple, right?<br>
<br>
Here is code I found on Drupal that seemed to do what I wanted, but<br>
didn't work for some reason. I don't really know PHP that well, and was<br>
hoping someone could point out the problem.<br>
<br>
------------------<br>
|<br>
<?php<br>
//code snippet for causing block to show based on a node's taxonomy term.<br>
$make_block_visible = FALSE;<br>
$term_id_to_trigger_show_block = 221;<br>
<br>
if ((arg(0) == 'node') && is_numeric(arg(1))) {<br>
$terms = taxonomy_node_get_terms(arg(1));<br>
foreach($terms as $term) {<br>
if ($term->tid == $term_id_to_trigger_show_block) {<br>
$make_block_visible = TRUE;<br>
}<br>
}<br>
}<br>
?><br>
<br>
------------<br>
<br>
|Also, is this possible using a CCK text field, instead of a category<br>
term? That would be ideal.<br>
<br>
Thanks,<br>
<br>
Peter<br>
<font color="#888888"><br>
--<br>
[ Drupal support list | <a href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a> ]<br>
</font></blockquote></div><br></div>