The correct taxonomy term varies depending on what the author selected. Yet the insertable links have a particular term hard-coded.
For example, Contemplate is showing " print $node->taxonomy[36]->name " which is all fine and well for the nodes that have term 36. But what about nodes that have term 39?
How does one make this properly dynamic?
Comments
Comment #1
clockwood commentedI just encountered this problem as well. I need to be able to display the correct taxonomy term per node in the teaser/page output. Currently it appears to provide only the path of the first(?) node in the taxonomy for the content type you are are creating a template for. Are there any workarounds?
Also, I noticed that the breadcrumb on the contemplate admin page improperly (also shows the path of the first(?) node in the taxonomy for the content type you are are creating a template for). For example, if the first node in Content type A is Green Widgets, the breadcrumb path on the Content type A contemplate edit page shows Home > Widgets > Green Widgets.
Comment #2
nancydruWow, I just looked at the issue statistics for this module and had to go look at others just to make sure I was seeing things right. This is the only module I have ever seen that has NO fixed issues. None, zero. But there are 8 releases.
Comment #3
field4000 commentedI found this snippet: http://drupal.org/node/92838#comment-190334
I'm not sure that's what you're looking for.
You'll have to edit it to suit your needs. But it will return the taxonomy term.
Comment #4
nancydruNope, that's not it.
Frankly, to me, it appears that this module has been abandoned.
Comment #5
field4000 commentedTry this:
Comment #6
nancydruI guess I need to restate this: Contemplate is hard-coding the taxonomy term number for which ever node it is currently looking at when you set it up. In the case I described it was 36, but that was only for that node. The next node has term number 39, so it is incorrectly processed since the template still says 36.
Comment #7
field4000 commentedHi nancyw,
I understand your question, I am simply giving you a workaround for something which isn't working as it should.
If you place the above code in the contemplate.module file. Then call the function from your contemplate, the node should be displayed with a link.
I cannot take any credit for this work. It was all styro: http://drupal.org/node/217573
Comment #8
jrglasgow commentedI find this to be a duplicate of #183106: insert taxonomy links as usual .... This is the solution I posted there.
Comment #9
jrglasgow commented@nancy
This module has not been abandoned, jjef has been busy with his other modules and his business, so I have just became a co-maintainer. I am working on going through the issue queue to find all the problems and ee if I can get them fixed. If you have any problems I can help you with I will try to do my best.
Comment #10
nancydruFix the original issue? This is not a theming issue.
Comment #11
jrglasgow commentedHere is the exact way to fix the issue:
How to make this properly dynamic?
$node->taxonomyis an associative array of objects. When you don't know the keys for an array you can use foreach.This code will create an object
$termprint_r will print that object so you can see what is available in the object$term.Example:
Then for the net
$termthat is supplied by foreach:Not knowing what exactly what you need to do with this I can only give you one example, this will print a list of taxonomy terms:
This list will look like this:
If you want a comma seperated list:
It wold look like this"
Comment #12
summit commentedHi, is it possible to show the primary term first, related to these snippets, thats why I ask?
greetings, Martijn
Comment #13
jrglasgow commentedyou could show the primary term like this
This will leave you with an string that is a comma separated list of your terms(
$terms), and an object ($primary_term)representing the first term encountered.Comment #14
socialform commentedI'm wondering if the original problem of NancyDru's was fixed?
I need to be able to print the term id for a specific vocabulary. There is only one term per node for that vocabulary. But of course the term on another node is different and so the id is also. Contemplate only offers the current node's term id.
$node->field_author[0][210]->tid
210
When you view another node you do not get the id.
Am I missing something? I just want to print term id's to use in URLs. I do NOT need to display terms.
Thanks!
Comment #15
socialform commentedok, this did it.
You just need to specify the vocabulary id... which in my case is 5.
I just altered what i found here:
http://drupal.org/node/88890
Is there a better way to do this? It would be nice if Contemplate could generate this for you.
Comment #16
Marko B commentedThe #15 isnt working in contemplate module, so dont know why did you post it here?