I have made a block view that shows all nodes with the same terms as the current node.
The code is:
$node = node_load(arg(1));
if ($node) {
$terms = taxonomy_node_get_terms_by_vocabulary($node, 1);
foreach ($terms as $tid => $term) {
$tids[] = $tid;
}
return implode ("+", $tids);
}
return false;
It works perfectly, but now I wanna show only nodes that have the same term of vocabulary A and vocabulary B. What would I have to add to the code?
Comments
Comment #1
dawehnerI don't testet it but i think it works
Comment #2
esmerel commentedThis should be evaluated for inclusion in documentation. assigning to myself for that reason.
Comment #3
summit commentedHi,
How about related terms.
Whe you have a vocabulary about geographic information: countries, regions, places and a vocabulary about categories.
How can I get the terms which are having nodes. Say a node camping x in belgium has the terms belgium, antwerp area , and antwerp and the category familycamping.
How can I get on the term page Familycamping show a block of for this example
"familycamping - antwerp"
Thanks a lot for your reply in advance.
greetings,
Martijn
Comment #4
Letharion commentedThere's a function "taxonomy_get_related" which will "Find all term objects related to a given term ID.".
You should be able to use that instead of "taxonomy_node_get_terms_by_vocabulary".
Comment #5
summit commentedHi, Thanks, can I get then say all terms only from a vocabulary on a termpage which is different from the vocabulary of the TID which is shown on the url ? Say the url is taxonomy/term/10 and 10 is a term in vocab 1.
How can I then show a block which shows this term, and a term (familycamping which some nodes also hold from another vocabulary, say 2, which is camping_sorts?
May be you can show a code-exampe please?
Thanks a lot in advance!
greetings, Martijn
Comment #6
Letharion commentedI'm sorry, I don't understand your question. What is the relation between the vocabularies? It seems arbitrary.
Comment #7
Letharion commentedComment #8
summit commentedHi, The relation between the vocabularies is are the nodes!
A node has terms from both vocabularies, and when term pages of one vocabulary are shown I would very much show a list of terms from the other vocabulary(ies) attached to the nodes.
Is this more clear please?
Thanks for still considering this.
greetings, Martijn
Comment #9
Letharion commentedAre you still using Views 2.6?
It's also important that you reset the status to active when you've answered previous questions, otherwise the issue is easily forgotten.
I'm assigning this to myself so I will remember to look into this a bit further.
Comment #10
summit commentedHi, Set the issue to newest 3.x-dev. Thanks for looking into this!
Greetings,
Martijn
Comment #11
iamjon commentedClosing this from a lack of activity.
Comment #12
summit commentedSet to active, didn't have answer from Letharion yet, as stated in #9.
Don't know why closed because of lack of activity. I think Letharion didn't had time to respond yet.
I do not think 3 months is big in Drupal perspective. Eager for your reply still Letharion.
greetings, Martijn
Comment #13
R.Hendel commentedHi, is this still an active issue?
I would fix this to clean queue. Please reopen it, if you want to work further on it.
Otherwise it would be closed automatically after two weeks.
Comment #14
R.Hendel commentedforgot to tag with dvcs11...