I am trying to access the taxonomy of a node. The node object's taxonomy renders like this:

node (Object) stdClass
  tags (Array, 1 element)
    4 (Array, 1 element)
      6969 (Object) stdClass
        tid (String, 4 characters ) 6969
        vid (String, 1 characters ) 4
        name (String, 16 characters ) TestTag
        description (String, 55 characters ) TestDescription
        weight (String, 1 characters ) 0

What I am trying to get to is $node->tags['4']['6969']->name, but I must be doing something wrong 'cause I can never seem to print it out on the page.

Any help?

Comments

tnightingale’s picture

Try removing the quotes from around the numbers, that should do it.
$node->tags[4][6969]->name

Hope that helps!

kovalev’s picture

You know, you can always do that in 2 lines...

$tem_obj = $node->tags['4']['6969'];
$name = $temp_obj->name;

(there is a chance you missed that....)

nicholas.alipaz’s picture

Thanks for the help guys...

Turns out it was a bug in computed fields.
http://drupal.org/node/328645#comment-1282610

I was doing everything right in my code originally, it was just that I didn't have access to the $node variable's tags as I thought I had.

Thanks again.