I was able to get the image to show in the place that I want, but I was curious if there was a way if I could have that image perhaps linked to that taxonomy term?

Thank you very much!

Comments

Bevan’s picture

That's what taxonomy_image module is for. I think I'm not understanding your question / problem correctly...?

dmetzcher’s picture

I think this is a question about having the user be able to click the taxonomy image on a node and have all nodes within that taxonomy be displayed. That's my question, anyway.

brewreview.info’s picture

I think bevan is right: this is functionality that should come straight "out of the box", without much hacking. For example, here's what I have in my node.tpl.php to display all of the taxonomy_images I have associated with each node -- and all images linking to their respective term:

<span class="taxonomy_taximg">
<?phpforeach (taxonomy_node_get_terms($node->nid) as $term) {
echo "<a href=\"".base_path()."taxonomy/term/".$term->tid."\">".taxonomy_image_display($term->tid, " alt='$term->name'")."</a>";
}
?></span>

(I think there's a code mod for this floating around that automatically uses the more intuitive URL Alias vice the clunky "/taxonomy/term/###" URL syntax, but it works well enough for my needs...)

Hope this helps some; YMMV.

Cheers,
//TB

goddess’s picture

Ok, I'm thinking if you change this line from this-

echo "<a href=\"".base_path()."taxonomy/term/".$term->tid."\">".taxonomy_image_display($term->tid, " alt='$term->name'")."</a>";

To this, with the name specificed in the link code instead of "tid" for the term id, it might work.

echo "<a href=\"".base_path()."taxonomy/term/".$term->name."\">".taxonomy_image_display($term->tid, " alt='$term->name'")."</a>";

You'd have to watch your pathauto to make sure your individual setup complies...I haven't tried it yet, though, but was interested in doing something similar. Someone please correct me if that's not accurate.

nancydru’s picture

But not everyone wants the term to link like that. How would you resolve that dilemma?

And, yes there is a function in the path module that will look up an alias for you, but it will be displayed anyway when the user sees the resulting page. How many users look at the link preview to see where it's going? Most of mine don't even know it's there.

nancydru’s picture

Status: Active » Postponed (maintainer needs more info)
summit’s picture

Subscribing in relation to the taxonomy_block module to show images with nodes.. greetings, Martijn

nancydru’s picture

Status: Postponed (maintainer needs more info) » Fixed

The taxonomy_image_get_object function will build a "taxonomy/term/xxx" path and replace it with an alias, if one exists. You'll still have to put it all together for the time being though.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.