Printing taxonomy terms in node.tpl I am trying to print taxonomy terms using this code:

&lt;?php foreach ((array)$taxonomy as $item) { ?&gt;
&lt;a href="&lt;?php print base_path() . "taxonomy/term/" . $item-&gt;tid; ?&gt; "class='tags'&gt;&lt;?php print $item-&gt;name ?&gt;,&lt;/a&gt;
&lt;?php } ?&gt;


It works fine if I put in contemplate, however it doesn't in the full node (node.tpl.php), the tags are empty in the full node. Can any one tell me what is the reason for this and how to fix this?
First verify that the $taxonomy variable is available and populated in your node.tpl.php file. ... 

EDIT:

Your accessing the values in your $item variable like it is an object but your casting to an array. Try accessing as an array:

 &lt;a href="&lt;?php print base_path() . "taxonomy/term/" . $item['tid']; ?&gt; "class='tags'&gt;&lt;?php print $item['name'] ?&gt;,&lt;/a&gt;