By Sc0tt on
I see the desired values using <?php print_r($node); ?>, but I can't get at them using the following code:
<?php $authors = taxonomy_node_get_terms_by_vocabulary($nid, 8);
foreach ($authors as $term) {
print $term['name']; } ?>
Can any php guru correct my syntax? Or, if I'm way off in my approach, can anyone recommend a better way? The desired result is a byline that looks like this:
Story By Barak Obama, Dmitry Medvedev, Nicolas Sarkozy and Gordon Brown.
Thank you,
Scott
Here is my <?php print_r($node); ?> output:
[taxonomy] => Array
(
[288] => stdClass Object
(
[tid] => 288
[vid] => 2
[name] => AYSO
[description] => Sports - AYSO
[weight] => 2
)
[529] => stdClass Object
(
[tid] => 529
[vid] => 8
[name] => Barak Obama
[description] =>
[weight] => 0
)
[530] => stdClass Object
(
[tid] => 530
[vid] => 8
[name] => Dmitry Medvedev
[description] =>
[weight] => 0
)
[531] => stdClass Object
(
[tid] => 531
[vid] => 8
[name] => Gordon Brown
[description] =>
[weight] => 0
)
[534] => stdClass Object
(
[tid] => 534
[vid] => 8
[name] => Nicolas Sarkozy
[description] =>
[weight] => 0
)
[384] => stdClass Object
(
[tid] => 384
[vid] => 7
[name] => Sports
[description] => Sports
[weight] => 99
)
)
Comments
I was able to get what I wanted
using the following code: