0
votes

I created a content type matches, and added two taxonomy fields - hometeam and awayteam. Both fields are saved in taxonomy vocabulary with name teams.

I want to make a view that show me awayteam related nodes. What i want is to get awayteam name from the current node and show nodes where hometeam or awayteam is like current node awayteam name. I watch a lot of tutorials, but i cannot make it right.

1
can you please make it more clear "What i want is to get awayteam name from the current node and show nodes where hometeam or awayteam is like current node awayteam name. I watch a lot of tutorials, but i cannot make it right."?S Singhal
I am very close to provide you the exact solution, I already completed it but need to understand your last statement.S Singhal
When i open a node i have two taxonomy fields, first one is hometeam(contains hometeam name) and second is awayteam(contains awayteam name). I want to get awayteam name from current node and show related posts where hometeam or awayteam name is equal to current node awayteam name.Димитър Димитров
If this will be SQL it will be something like Select * from match where hometeam='current_node_awayteam' or awayteam='current_node_awayteam'Димитър Димитров

1 Answers

0
votes

So you will be using relationship and contextual filter and Views PHP Module

  1. Add a new View, with a block display
  2. Add your taxonomy field awaytown at relationships
  3. Add again your taxonomy field at contextual filter, and In the group, "When the Filter Value is NOT available", select Provide default value, and choose Type " PHP code. You will have to do some php to get the value of the taxonomy field to use it as a filter
  4. Add a PHP based Filter to remove the current node from the view results (requires Views PHP) You can find more info here : https://www.drupal.org/node/2323539