1
votes

I'm trying to set a contextual filter for a block type views but when I preview it, it returns nothing... More specifically when I try the same view as a page the Contextual filter is working fine and filtering the content but when I try the view as a block nothing is returned although the "Provide default value" is set as "raw value from url". Any idea what might be the problem? By the way I tried the solution here but it's still not working https://drupal.stackexchange.com/questions/13868/drupal-7-views-contextual-filters-with-page-blocks

4
I assume you have set the path component to read the context. Can you show us the path you are using in the URL? In particular is the component multiple words and what is substituted for the spaces between words?Ashlar
What kind of contextual filter are you using?Cyclonecode
Take a look here .Worked for me!Bogdan Alexandru Militaru

4 Answers

1
votes

When using views as blocks you need to enable ajax for the filters to work specially if its exposes.

go to advanced -> other -> and enable ajax and see it it works.

cheers, Vishal

0
votes

i ran into a similar situation: i was using content title as the contextual filter for a page, but when i tried to use the same filter for a block, the block doesn't show up. when i set the filter for the block (just the block) to content nid and set the default value to 'content id from url' it worked like a charm EVEN THOUGH THE CONTENT ID IS NOT IN THE PATH ALIAS. weird.

0
votes

This might help someone...

I had the default view set correctly (in my case: raw url -> /part 2/, tick path alias) and the validation criteria set correctly (taxonomy term -> tick correct content type -> term name converted to id) but I was passing a third argument from my views_embed_view function call:

<?php print views_embed_view('recommended_documents', 'three', **$node->id**); ?>

I believe the arguments from the third onwards become the contextual filters values that are checked against, which we're looking to override with the raw URL.

-2
votes

The solution was to re-install drupal, no idea why, clearing the cache wasn't helping.