Contextual Filter (Url) mit Block View
am 06.04.2012 - 17:51 Uhr in
Hi,
ich habe einen PageView (/news) von mir in einen BlockView geändert um flexibler bei für mein mobile Theme zu arbeiten. Problem ist jetzt aber, dass der Contextual Filter über die Ur nicht mehr geht. (früher z.B. /news/design)
Funktioniert ein Contextual Filter über die Url eigentlich mit einem BlockView?
lg
Christoph
- Anmelden oder Registrieren um Kommentare zu schreiben

Wenn ich mich nicht täusche,
am 06.04.2012 - 21:53 Uhr
kann ein Block die Url Angaben direkt nicht verwenden, aber die Lösung kann dir bestimmt einer besser erklàren wie ich. ( http://www.compago.it/manuali/35-utilita/345-how-to-create-a-related-blo... ) denke der link erklärt wie es geht.
genau das suche ich, aber
am 06.04.2012 - 23:09 Uhr
Hi,
danke für den Tipp. Das ist eigentlich genau das was ich suche. Leider funktioniert es bei mir noch nicht. Ist der zweite Filter dazu da, dass man alle Einträge anzeigt, wenn kein Filter in der Url steht? Das ist mir nicht ganz klar warum er den macht.
Bei mir werden, wenn ich meinen View so umstellen, keine Einträge auf der Hauptseite "news" angezeigt. Auch im Backen unter Views nicht. Dort geht es aber, dass beim Preview den Filter "design" schreibe. Dann werden wir wie gewünscht nur alle Design Artikel angezeigt. Leider geht das auf der Seite selbst nicht. Bei "news" habe ich eine Leere Seite nur mit der Page Überschrift und wenn ich auf "news/design" gehe, findet er die Seite nicht.
Weißt du vielleicht woran das liegen kann?
Danke und lg
Habe jetzt mein nach diesem Post ertsellt
am 08.04.2012 - 18:15 Uhr
Natürlich muss ich auch manchmal wieder nachsuchen.
Posted by damiandab on August 18, 2010 at 12:28am
Check this post:
http://drupal.org/node/216719#comment-3340876
Login or register to post comments
The argument you want in this
Posted by alan.pinkert on August 18, 2010 at 1:12am
The argument you want in this kind of view is Node: ID and select Default argument -> from URL. This will load only the node you're currently viewing.
Then, create a relationship for taxonomy:related terms (the one with the description "Relate nodes to taxonomy terms..."). This will load all the terms that are tagged to that node.
Next we want to load all the nodes tagged with the terms we just loaded with that relationship. So, add a new relationship for taxonomy: node, and at the top of its settings, under Relationship:, select the relationship you just created.
Now you can start adding your fields. Add a node: title field if you want that function (I also like using it to test my view), and remember to "use" the node relationship that we just created by selecting it in the field's settings (you'll want to do this for all your fields).
Note that this loads ALL nodes tagged with ALL tags from the currently viewed node. Unsurprisingly, this loads the currently viewed node also! So in your "similar content," you'd see the page you're already on. To stop this, we can use arguments again.
So, we want to exclude the current page from the nodes loaded in our "node" relationship.
Add an argument for Node: ID again, but this time, "use" the node relationship that we have. Once again make it a default argument, Node ID from the URL, but this time, scroll down and check off the "exclude this argument" checkbox. This will make the argument be, well, excluded (pretty self-explanatory).
Make it a block (add a block display), put it in a region under site building -> blocks (you also might want to restrict the pages it's on), and viola!
NOTE: When you preview the view, you'll have to enter a node id into the little arguments field. Since you have two arguments, you need to type in 346/346 (for node id 346, for example). Never fear though, both arguments will work if your URL is simply node/346 and not node/346/346. Just a weird thing in the way views are previewed.
Hope that helps
Alan