Active
Project:
Taxonomy Image
Version:
6.x-1.x-dev
Component:
Views
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
30 Nov 2010 at 13:10 UTC
Updated:
4 Sep 2012 at 08:23 UTC
Hello,
I am trying to get the taxonomy images to display on the Views Summary page, but to no avail. Basically, it's a list of company names, and I want to replace the names with their logos. I'm not much use at programming. Could someone please tell me how I might solve this problem?
Comments
Comment #1
neillodwyer commentedComment #2
RKopacz commentedSubscribing. I would also like to be able to do this. Is there any way to do this programmatically, that anyone knows? The view should be calling in the tid's, and I was thinking that it is possible with taxonomy_display_image() that comes with Taxonomy Image, but I can't seem to be able to find the right variables to call in as parameters.
Comment #3
RKopacz commentedHey, I don't know if this is just obvious, but just in case somebody is looking for a solution to this, here's what I did to get a taxonomy image into the views summary page, when taxonomy terms are used as arguments, using the Taxonomy Image module (which must be enabled, of course).
First you need to pull out the views summary template. its in the folder for the Views module. There are two, one for unordered lists and one for unformatted fields. I used unformatted fields:
views-view-summary-unformatted.tpl.php
The inside of that template looks like this:
The function used to display the taxonomy image is taxonomy_image_display($tid). You get the relevant term id variable from within the view by pulling the variables using the devel module and the dpm() function that comes along with it, and a special preprocess function for the summary view, which you place in your template.php file (put your theme name in place of 'themename' in the function:
It took me a while to find this, but the way to get the variable holding the relevant term id is with the following:
So, within the template for the views summary, you would need to insert that variable as a parameter for the taxonomy_image_display() function to call the image into the template:
You now need to just wrap it in some PHP tags with a print function before it, and then, just for good order, wrap that in a div with a class selector, and your image should display.
The code inside the views summary template will now look like this:
Your taxonomy image will now display together with the link to the view page for that taxonomy term. You'll just need to add a few style properties to get it to look the way you want.
If anybody sees another way to do it non-programmatically, let me know. I haven't found one.
Hope this helps someone trying to do the same.
Comment #4
vlooivlerke commentedHi this works great with taxonomy term Id as the argument.
How can I use taxonomy term name as the argument?
Taxonomy term name is better in search engine url
working url : taxonomy/term/123
need to do url like this: taxonomy/term/fruit
Thanks
Comment #5
vlooivlerke commentedHi, I used the devel module and your steps to inspect the view.
The term name argument make use of the term_data_name table
term_node_tid (Array, 3 elements)
field (String, 3 characters ) tid
table (String, 9 characters ) term_node
alias (String, 13 characters ) term_node_tid
term_data_name (Array, 3 elements)
field (String, 4 characters ) name
table (String, 9 characters ) term_data
alias (String, 14 characters ) term_data_name
How can I add the term_node_tid field to the taxonomy name argument
Comment #6
vlooivlerke commentedAfter doing some inspection I noticed that the table term_data is used in every taxonomy argument but the the table term_node is only used in arguments were you use the term ID.
The table term_data has a row tid. How can I set the taxonomy image if I know the name of the term in the argument
something like