$taxonomy array empty?

sderrick - May 31, 2009 - 03:02

I'm trying to use the taxonomy image module in Drupal 6
I installed the module, uploaded images for an existing vocabulary. Everything seemed to go fine. The items show up OK in a cck view as a content taxonomy field. I need to display the images associated with each item in the vocabulary

I inserted in my node.tpl.php file, per the documentation.

<?php
 
if ($taxonomy)
  {
   
$output = NULL;
    foreach (
$node->taxonomy as $term)
    {
      echo
"1";
      if (
$image = taxonomy_image_display($term->tid)) {
       
$output .= "$image";
      }
    }
    echo
$output;
  }
?>

Nothing was displayed.

I added some echo lines and realized $taxonomy was evaluating as empty?

the following code

<?php
/* if ($taxonomy)*/
 
{
    echo
$taxonomy;
   
    print
"<PRE>";
   
print_r($taxonomy);
    print
"</PRE>";

    print
"<PRE>";
   
print_r($node->taxonomy);
    print
"</PRE>";

?>

outputs
Array

Array
(
)

Array
(
)

indicating the taxonomy arrays are empty?

Is this correct?

Scott

Isn't anybody using

sderrick - May 31, 2009 - 12:54

Isn't anybody using $taxonomy?

I really need a clue as to why this isn't working...

thanks,

Scott

I'm having the same problem,

charlie1234 - July 20, 2009 - 03:29

I'm having the same problem, I posted this issue at http://drupal.org/node/133223 but no one has responded yet.

If I edit a node the taxonomy is already selected in the dropdown menus, so I know it's defined for these nodes it's just not appearing anywhere in the $node object.

BTW, $terms also returns nothing, and it appears that this array *is* setup by my theme.

UPDATE: I started with the explanation on this page: http://drupal.org/node/66078 - and realized I needed to navigate to http://www.example.com/admin/settings/taxonomy_hide and uncheck "hide" for all of my taxonomy terms to work with them. This page's description is misleading tho, as it leads the average Drupal user to think that this is going to be auto inserted into your node's content output when really it just "releases" it into the $node object and allows you to work with it if you'd like to.

 
 

Drupal is a registered trademark of Dries Buytaert.