1

I have created an "Add Question" content-type node which lets users ask questions. The questions have a title, image attachment option, and the content.

I am showing the questions which have image as a block by filtering it as "Content: Photofield - list True" in Views. This way, only the questions which have images attached to the question appear in this block. Photofield by the way is the content type.

I want to create a new block which only shows the questions which have no attached image. I have done filtering this block view by keeping filters as "Content: Photofield - list False" but in vain.

There's also some expose option and I did some messing around with it too without coming to the result I want.

Can anyone help?

Sushi
  • 631
  • 1
  • 8
  • 19
  • Is it possible to manually relate the table and make sure "require this relationship" is unchecked? This might be like a left join and you can filter for null values. This is just an idea... – Rimian May 31 '10 at 11:28

1 Answers1

1

The "Content: Photofield - list" filter only applies to nodes with an attached image, because it is filtering by the value of the "List" option (which only exists if there's an image). If the node has no attachment, this filter won't do anything.

As fas as I know, you'll need to either implement hook_views_query_alter() to add an WHERE clause to the View's query or programatically test if the node have an image in a view template.

Vinicius Braz Pinto
  • 8,209
  • 3
  • 42
  • 60
  • Sounds like your suggestion to use `hook_views_query_alter()` is the best option in this case. Here's the documentation [http://drupalcontrib.org/api/function/hook_views_query_alter/6](http://drupalcontrib.org/api/function/hook_views_query_alter/6). – Erik Töyrä Silfverswärd May 31 '10 at 10:32