Posted by borfast on May 24, 2009 at 3:30pm
| Project: | Taxonomy Image |
| Version: | 6.x-1.6 |
| Component: | Views |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
| Issue tags: | different, display, duplicate, image, taxonomy, taxonomy image, term image, tid, views, vocabulary |
Issue Summary
Hello.
I have a view that outputs a list of nodes and each node may have more than one taxonomy term, even from different vocabularies - how can I output all of these, or select from which vocabulary I want the images to be displayed?
Thanks.
Comments
#1
Hello,
Same need here (with the same version, 6x-1.6). I'd like to use Taxonomy image as a way to display various little black and white logos (a taxonomy image previously associated to a term) near a photo and some text in a view. But I can only display one logo or twice the same one (please see screenshot) while adding another "Taxonomy: Term Image" field. The tid seems to call always the same term, but obviously, I would like to show different thumbnails (from different vocabularies or from a single "thumbnails" vocabulary if the former is impossible) in a single "teaser".
This may comes from the Views module above all, but we were asked to ask you first, so...
#2
Anyone?
#3
ErwanF, I ended up adding a function to template.php to (sort of) achieve what I wanted.
The function takes the output of the "Taxonomy: all terms" views field, which is basically an HTML list of links to each taxonomy term. I break them apart and replace the linked text with the desired image.
Far from perfect, since this should belong in the module itself, but at least it works.
Note: "Tamarind" is the name of the theme I'm working with.
function tamarind_tax_image($subject) {
$links = explode(', ', $subject);
$pattern = '/taxonomy\/term\/(\d)/';
$result = array();
foreach($links as $link) {
preg_match($pattern, $link, $matches);
$image = taxonomy_image_get_object($matches[1]);
if ($image) {
$result[] = l($image->img, $image->term, array('html' => true));
}
}
return $result;
}
#4
Thanks a lot for the "tip", borfast, I'll try that.
#5
Please could you explain? How do replace the term name by its image? At the time of writing, I can only display the terme name...
#6
I didn't manage to make this working. So sad...
#7
ErwanF, sorry, I had not yet seen your request for an explanation.
When I say
I mean that I have a "All terms" field, which prints something like
<a href="taxonomy/term/5">Books</a>, <a href="taxonomy/term/6">Cars<a>, <a href="taxonomy/term/7">Houses</a>and I break it apart on the commas, which yields an array of individual links, which I then treat as necessary.The commas are separating the links because that's how I configured the field.
#8
I developed a patch for this module, which is atached to this comment. It allows to display all term images for a given node as a single view field without generating duplicate rows. They are especially frustrating if you use multi-choice vocabularies to tag articles on your site, like me. Tested with drupal-6.14 and taxonomy_image-6.x-1.6.
After applying the patch flush caches so that views will use new field definitions and restart Apache to purge PHP optimizer caches.
Edit your view and add a new field. Choose "Taxonomy: All term images" as a field type. Here you have an option to limit search for images in a given set of vocabularies, similar to the "Taxonomy: All terms" field, and additionally you can choose to display only one image, if more than one are available.
Internally, this field creates two fictious query fields, "all_tid" and "all_tid_all_tids". The latter is an array of image ids and is used internally to render multiple images. The former is the master field and it contains only a single term id for an image. I needed it for compatibility with the "timeline" module, which cannot work with multiple images.
All the best.
#9
Subscribing
#10
Thank you vidkinet for your patch, it is working well. I built it as a module that adds a field All terms image in the views field.
Enjoy
Manu
#11
You sir are brilliant! Saved me on this one!
By the way, something with tar that isn't right. I had to open and manually upload each file. Does not extract properly.
#12
I have had a strange bug. The module works great but it seems there might be a little glitch. In a grid view, the first item does not show any images. Attached is the error. The images are the hotel amenities icons below the hotel pic. As you can see the first hotel in the grid is not showing any amenities icons.
#13
The Taxonomy Image module was a great find (actually a referral from a post for solution); thanks NancyDru. After spending about 6 hours to upload a flag icon for some 300 countries, I was sweating when my views came up flagless; and wondering how to specify which tax term image to display.
So, major thanks to vitkinet and manumilou for whipping up this patch and module! It will be a great addition to the new version of the mod.
Greta
#14
I can confirm that this bug with first image is happening, but it seems that it happens in every view style (grid, html list, unformatted). Possible sql bug. Im not a real programmer so cant help here. Hope that this bugfix will not be forgotten. Cheers!
#15
Is this supposed to be working with relationships?
I have it working when the terms are attached to the primary nodes called for a view, but not in relationships where the terms are attached to a different node and referenced via a node reference CCK field.
The All Terms field works that way, but not the All Terms images.
Great and critical addition to the TI module by the way!
#16
I'm trying to make a views2 slideshow of taxonomy images from a certain vocab. It works fine displaying the terms, but when i try to display the images, i get nothing. any ideas?
i've been searching everywhere and can't find a solution. hope this is an ok thread for this issue!
#17
Hi, I made a patch (against 1.6) to make this work without a seperate module. If anyone is interessted. Haven't tried it with gridview.
#18
+1 to see this included in the module. Very helpful.
#19
+1 to see it (patch from #17) included in the module.
The new views field "Taxonomy All Terms Images" is very useful.
Thanks a lot for all contributors.
#20
here is another issues #493150: New Views Field: All Associated Taxonomy Images.
There is also a patch which, i think, gives us the same functionality.
Can anybody review both patches and tell us which of them is better for commitment?
#21
i attache the patched module (i patched manually the dev version from 2010-May-03).
#22
The patch from #17 works fine if we use only one "Taxonomy All terms Images" field inside of our views.
But if we add 2 "Taxonomy All terms images" fields then the settings from the second field will override the settings of the first field.
See attached file.
#23
Subscribing
#24
subscribe
#25
Just tried patch #17 and wanted to say thank you! it seems to work perfectly with 6.x-1.6
#26
same error of #22. Impossible to show two or more All terms image field.
#27
#21 Module works perfect!
#28
Many thanks to all!
#29
Thank you #21! Makes life so much easier when things work perfectly!
#30
I installed the patch from #21, but when I try to add a "Taxonomy: All Terms images" field to my View, I get the following error:
Error: handler for term_image > all_tid doesn't exist!
When I hit the cancel button, I end up with:
Broken/missing handler: term_image > all_tid
I'm running Drupal 6.17 with Views 6.x-2.11.
UPDATE: I reverted back to Taxonomy Image 6.x-1.6 and installed the separate module from #10, and everything is working nicely now. Thank you!
#31
Thank you it works for me.
I wonder if I could access the value returned by the field from a page.tpl.php or page-taxonomy-term.tpl.php, and exclude the field from the display in the view; so I can display the image out of the embed view.
I tried to use the template_preprocess_views_view_field in my template.php. But I don't know how to get further with this.
Thank you.
#32
#10 works for me - thanks
#33
Thanks to everyone who contributed to this patch. It work a treat. Very helpful indeed.
#34
Patch on #493150-22: New Views Field: All Associated Taxonomy Images working, doesn't suffer settings bug above, does seem to re-use more of the views class (and still works as of this moment with views 3).
#35
when can this be rolled into working dev? this works great for me w/views 3
#36
Does Views 3 even have a full official release yet?
The status here is "needs work" and I'd like to see RTBC.
#37
Hi all,
I am new to drupal. My hosting doesn't allow me to patch. Can anyone suggest how can I get the patch to enable All Term Image to work? Really appreciate if anyone can help!!
#41
#37 You may want to try http://bri-space.com/content/how-patch-drupal-module-windows
I used it for another patch, but due to version incompatibility, it didn't work for me. But it may work for this patch.
Here's another thread of patch for windows... http://drupal.org/node/23844