Hello,

I've followed the directions from these links:
http://drupal.org/node/44922
http://drupal.org/node/64215#comment-177566

I've updaged my template.php with this:

<?php
function _phptemplate_variables($hook, $vars) {
if ($hook == 'node') {
   if (module_exist("taxonomy_image")) {
      foreach (taxonomy_node_get_terms($vars['node']->nid) as $term) {
       $vars['taxonomy_images'][] = taxonomy_image_display($term->tid, "alt='$term->name'");
      }
   }
}
return $vars;
}
?>

...and my node.tpl.php with this:

<div class="taxonomy_image">
<div style="float:left;">
<?php print $taxonomy_images[0] ?>
</div>

If the content has more than one tag (i.e.) a community tag, it sorts them alphabetically and only shows the one image that is alphabetiaclly first (if there is an image for it), but none of the others.

Is there a way to make it show images for all the terms that have images? Am I making sense?
Thanks.

Comments

discursives’s picture

and ill come back and let you know if i find something

Antikx’s picture

Any luck? :)

bradweikel’s picture

I haven't actually tried this, but it looks pretty straight forward...

The first snippet uses a foreach loop to fill the taxonomy_images array with all of the images, but the second snippet only prints the first one ($taxonomy_images[0]);

Something like this should do the trick--


<div class="taxonomy_image">
<?php
foreach($taxonomy_images as $taxonomy_image){
print $taxonomy_image;
}
?>
</div>

This will just print them all inside the same div, though, side by side... so you'll need to tweak the above code and/or work some css wizardry to improve the layout.