I have a node type view. I would like to add a taxonomy field, where it gets only the parent terms to the specific node.
I have:
Church 1
John Doe
Uncle Sam
Church 2
Jane Doe
Jane Smith
Church 3
Goerge Washington
John Doe
Church 4
Mary Smith
Currently views "shows all" terms specific to that node, i.e. Church 1, John Doe, Church 3, Goeorge Washington. I need it to "show only parents" Church 1 and Church 3, linked to its respective term page.
If you can provide the snippet either, using views 6.2 natively, or a custom PHP code via Views Custom Field module?
I've been struggling for two days, using queries, and applying methods found in the following links?
http://drupal.org/node/1011946
http://drupal.org/node/216888
http://drupal.org/node/43290
http://drupal.org/node/866586
http://api.drupal.org/api/drupal/modules!taxonomy!taxonomy.module/functi...
If you can please post the code snippets here, in hopes it helps others find same or similar solutions?
This is my first time using this service, so I really don't know what to pay, say 50.00; I hope thats fine. I can send Paypal.
Comments
Hi, Please enable your
Hi,
Please enable your contact form, so people can contact you.
Acquia certified Developer, Back end and Front specialist
Need help? Please use my contact form
Ok I set the contact form.
Ok I set the contact form. Thanks
I was able to use dbforge query builder (very awesome tool) to create the sql, and provide me with the following array:
I turned this array into this:
with the following snippets:
This is where I am at now, on how to link the terms to their term page. My first guess is tu use links using l(...).
Also, I know the sql needs cleaning up, like do I even need to 'left join' the {node} table since the nid is already in the {term_node} table?
Anyways I'll still be working on this, would be nice to put it into a function in a custom module, then calling it from anywhere by only passing it the $nid?
:)
Hi, Here's the code to output
Hi,
Here's the code to output them as a link:
Acquia certified Developer, Back end and Front specialist
Need help? Please use my contact form
Thanks very much the
Thanks very much the feedback.
After personally trying I came up with this, which is similar to yours.
The other big question is, do I need to 'left join' the {node} table? Thanks
Hi, No left join for node
Hi,
No left join for node table is not required at all as we are getting nid from term node table.
Acquia certified Developer, Back end and Front specialist
Need help? Please use my contact form
Great Job - Great Teamwork -
Great Job - Great Teamwork - I'll contact you right now
Here is the snippet in module
Here is the snippet in module form, so you can use it anywhere.
Put this into your custom module:
Then call it from where every you want like node.tpl.php, views, etc..
Where $node->nid is your nid, and 1 is the vocabulary id you want. If your using views custom field module than substitute $node->nid, with $data->nid
Well I hope that helps people with similar issue, thanks to Sagar for his contribution!
CJ