开发者

Drupal: How do I manually print Taxonomy Images

开发者 https://www.devze.com 2023-01-29 06:58 出处:网络
Here is the code I use开发者_运维问答d to print taxonomy images per specific vocabulary using Taxonomy Image:

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

精彩评论

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