By alexiscott on
Hi Drupal developers,
I know that there is a term associated with my node, as I have checked in the DB.
But when I do this (In a flexinode .tpl file or even using template.php) I get an empty Array.
$terms = taxonomy_node_get_terms($node->nid)
print $terms[0];
Well, I do not see a relevant error in the PHP logs, or in the Apache logs, so I do not know how to test if the fuction call has worked.
Please help me to understand how to debug this one?
Alex.
Comments
Yeah, I think it can help
Yeah, I think it can help you:
You can use print_r to help you debug arrays.
I cant't use taxonomy_node_get_terms function theme's .tpl file
As Describe below i can't use that function in my site help me for that.
I am having a similar
I am having a similar problem, the node has terms but:
unset($terms);
$terms = taxonomy_node_get_terms($node->nid);
print_r ($terms);
returns only:
Array ( )
the code is on a flexinode phpTemplate page.
------------------------------------------------------
Jump through a few hoops, get a free iPod.
http://ipods.freepay.com/?r=8480908
Drupal 6
If you use Drupal 6 try this:
$terms = taxonomy_node_get_terms($node);
instead of this:
$terms = taxonomy_node_get_terms($node->nid);
To get node TID in D6
To get node TID:
Sasha
Print & Screen