By truls1502 on
I'm developing my theme, and using <?php print $node->taxonomy[2]->name; ?> in node.tpl.php, but I wonder how to get random number, also not always 2, but it can change automatic and find by itself. Someone have good solution of this?
My print_r ($node) tell:
[taxonomy] => Array ( [2] => stdClass Object ( [tid] => 2 [vid] => 2 [name] => NYHETER / NEWS 2011 [description] => [weight] => 0 ) )
Or do you have a better solution either in template.php or node.tpl.php to get show ONLY name of taxonomy without a link. If you can in template.php, I prefer most and less coding in node.tpl.php :)
Comments
.
you can use following code to print taxonomy term name in node.tpl.php, you can get all term name associated with particular node.
Thank you,
Kuldip Gohil
Thank you for your useful
Thank you for your useful code, just wonder do you know how make it into template.php and make an variables where I can use in different node also, node-info.tpl.php and node-news.tpl.php etc?
.
in your template.php you can add code in following hook then variable will available in node.php
Now you can use $my_taxonomy in your node.tpl.php
Thank you,
Kuldip Gohil