Hello,
I use Views for creating blocks.
Each block has an argument provided by the the node (ID).
Each block has exeptions and title managed by the block page (admin/structure/block)

My problem (photo enclosed):
If the view doesn't returns data, the title is still there. I try to put the title in the view title, I try to create a text field in the header of the view too, it's always the same.

If I put in "Behavior in the absence of results" any kind of informations, they are never displayed. It's seems that the view consider that there's always data returns....
Can you help?

CommentFileSizeAuthor
view-title.jpg27.99 KBzorax

Comments

dawehner’s picture

Status: Active » Postponed (maintainer needs more info)

First take sure that there is really no data in the result, there could be always some empty rows.

zorax’s picture

That it, I just add a filter field (content is not null), and the block is removed !
Thank's a lot!

dawehner’s picture

Status: Postponed (maintainer needs more info) » Fixed

Cool!

zorax’s picture

Hi,

I reopen this post because the subject is very close.
in the last print dev version (7.2 dev) there's a problem to get view content .
I used this function for displaying the view in a tpl file :
print views_embed_view('page_actu', 'block', $node->nid)
but I can't have the title displayed.
So I create a function for displaying content AND title in template file :

function view_embed ($nom,$vue,$arg) {
$view = views_get_view($nom);
$view->init();
$view->set_display($vue);
$view->set_arguments(array($arg));
	if ($view->render()) {
	$output = '';
	$output .= '<div id="block-titre"><h4>'. $view->get_title(). '</h4></div>';
	$output .= '<div id="block-view">'. $view->render() .'</div>';
	return $output;
	}
}

When I call this function there's always title displayed even if the page don't have a view result.
So I'm looking for a conditionnal customisation code to avoid. here if (!empty($view->result), or if ($view->render()) { doesn't works...
thanks

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Behavior in the absence of results