I'm attempting to embed a view inside a node template. However, whenever I call the view the browser returns a completely blank page.

Here's my code, note that I've tried many other solutions (such as calling the block with module_invoke) and such. My php memory is set to 128M !

$view = views_get_view("sub_products_overview");
if ($view) {
	print $view->preview("block_1");
}

My view export looks as such :

$view = new view;
$view->name = 'sub_products_overview';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Sub products overview';
$view->core = 7;
$view->api_version = '3.0-alpha1';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['query_comment'] = FALSE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'node';
$handler->display->display_options['row_options']['view_mode'] = 'full';
$handler->display->display_options['row_options']['links'] = 0;
$handler->display->display_options['row_options']['comments'] = 0;
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['link_to_node'] = 1;
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 0;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'product' => 'product',
);

/* Display: Block */
$handler = $view->new_display('block', 'Block', 'block_1');
$translatables['sub_products_overview'] = array(
  t('Master'),
  t('more'),
  t('Apply'),
  t('Reset'),
  t('Sort by'),
  t('Asc'),
  t('Desc'),
  t('Items per page'),
  t('- All -'),
  t('Offset'),
  t('Block'),
);

Comments

merlinofchaos’s picture

You don't end up in a position where the node invoking the view is part of the view, do you? That would be infinite recursion.

rwt’s picture

Title: Blank page after calling views_get_view() ! » Blank page (WSOD) after calling views_get_view() !

From my php error logs :

[16-Aug-2011 02:38:59] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 40961 bytes) in /Users/user/Sites/drupal7/includes/theme.inc on line 1246

How can it be exhausted when it tried to allocate only 40961 ???

merlinofchaos’s picture

That's simply the last chunk of memory it tried to allocate.

dawehner’s picture

Status: Active » Postponed (maintainer needs more info)

Question 1 is open

rwt’s picture

Priority: Critical » Normal
Status: Postponed (maintainer needs more info) » Closed (fixed)

I cannot believe I made such a simple mistake. My apologies.
The node--product template was indeed calling a view which loaded the same node and thus recurring the view display function.

Changing view's display to show Fields instead of raw node fixed my problem.

Thanks !