We've got a view that shows a set of photos. There's some instructional text in the View's footer telling the user to click for a larger version. We don't want this text to appear if there are no photos, but it *always* shows up, regardless of the state of the "Display even if view has no result" checkbox.
We're using 6.x-2.x-dev, dated 7/27/09
Comments
Comment #1
dawehnerCan you have a look, whether empty text works.
Additional i suggest you to have a look at the result, with php, or another display. It could be that there are results, but they are not displayed because there is no label for a field, but also not content for the field.
Sometimes views displays also empty fields.
Comment #2
friolator commentedOk, so apparently the view isn't really empty. The view itself is really simple - one argument, one field, two filters (published and type). It pulls in all images that are associated with the nid from the argument of the type in the filter.
I set the empty text to something, then fed the view a bogus argument (which is set to show the empty text if it doesn't validate), and got the empty text without the footer, as expected. So that much appears to work.
However, when I use a valid argument for a node that has no photos associated with it, I don't get the empty text and I do get the footer. I've tried to set the photo field to "exclude from display" (which will work because i'm printing it in the tpl file manually), and I've also tried setting it to "hide if empty" but in both cases, it's not showing up as empty.
I've looked at the output and threw in some debug text ("----" immediately before and after the view is inserted into the page) to see what Views is outputting exactly, and it appears to be pulling in the tpl file from 'views-view-grid.tpl.php' even if the query returns no result. Is there any way to prevent this from happening?
Comment #3
dawehnerPerhaps you could try out, to add the cck field to the filter and select "Is not empty(NULL)" as operator.
But this is just guessing.
Comment #4
friolator commentedthanks - that fixed it.
But I'd think that you shouldn't have to do that, so this would still be a bug, right? I mean, what if I was pulling in 10-12 fields, I would need to add this filter for each field?
Comment #5
merlinofchaos commentedEmpty shows if there are no records.
If you get records, even if all the fields you pull up have no output, the view is not considered to be empty.