0

I'm using Contextual filter on a view block which reads values from URL. This works on pages that created by Panels; however, it doesn't work on nodes(content type). I'm using url alias for nodes. It seems like even though the url displayed in defined alias, it doesn't pass the alias value when contextual filter read the node's url. The field that I'm using for the url alias is text list field.

enter image description here

Is there any way to make a view block with contextual filter on both pages and nodes?

Drupal 7.12 | views 7.x-3.3 | panels 7.x-3.2

2 Answers 2

2

I ran into a similar problem recently. The issue is that internally the "Raw value from URL" doesn't get its data from the URL, it gets its data from the unaliased url. So if you have a node with an alias like mysite.com/foo/bar, you would expect 'bar' to be the argument passed with a path component of 2.

However since foo/bar is actually node/123, internally it becomes node/123, and '123' is what gets passed to the view.

I have opened a ticket in the views issue queue (http://drupal.org/node/1658352). Hopefully it will see some light with a proper fix, as I dont believe that the expected behavior is to retrieve the unaliased path.

1

You can use "Provide default value" with type "PHP code". Inside PHP code you can get request_uri() which has alias and if you need argument from this alias, just use this code:

arg(1, request_uri())

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.