I am trying to embed a Views Slideshow view in my html.tpl.php file and cannot seem to get it to work.

I have the following code in my template.php file (the second part is the relevant part):

function mytheme_preprocess_page(&$vars, $hook) {
  // Remove the node title when on the front page
  if ($vars['is_front']) {
    $vars['title'] = '';
  }

  // Embed the Rotating Banner view into each page
  $vars['embedded_view'] = views_embed_view('rotating_banner','rotating_banner_block');
  $vars['scripts'] = drupal_get_js();
}

The machine name of my view is "rotating_banner" and the machine name of the block I want to embed is "rotating_banner_block".

I also have the following code in my html.tpl.php file:

<div id="views-slideshow-bg">
    <?php print $embedded_view; ?> 
</div>

The view is not displaying and I am getting the following error on all of my Drupal pages:

Notice: Undefined variable: embedded_view in include() (line 63 of /var/www/siteroot/sites/all/themes/mytheme/templates/html.tpl.php).

I attempted to follow the directions at this link, but have not had much success. Does anyone know what I'm doing wrong? Thanks in advance for any help anyone can provide.

Comments

NickDickinsonWilde’s picture

Status: Active » Postponed (maintainer needs more info)

Depending on your theme you may have a specific front template. If so edit that instead, if not, add a isset() check before trying to print.

NickDickinsonWilde’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)