开发者

Drupal: How do I manually print Taxonomy Images

Here is the code I use开发者_运维问答d to print taxonomy images per specific vocabulary using Taxonomy Image:

<?php
$vid = 19;
$terms = taxonomy_node_get_terms_by_vocabulary($node,$vid);
$new_terms = array();
if ($terms) {
    foreach ($terms as $term) {
    $term = taxonomy_image_display($term->tid) as $image);
    print '<div class="color">' . $image . '</div>';
    $new_terms[] = $image;
    }
}   
?>


Your code is broken. Did you mean:

<?php
$vid = 19;
$terms = taxonomy_node_get_terms_by_vocabulary($node,$vid);
$new_terms = array();
if ($terms) {
    foreach ($terms as $term) {
        $image = taxonomy_image_display($term->tid);
        print '<div class="color">' . $image . '</div>';
        $new_terms[] = $image;
    }
}   
?>

This is correct PHP and should work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜