0

I use this in my template.php for custom error pages:

  //custom 404 not found page
  $header = drupal_get_http_header("status");
  if($header == "404 Not Found") {
    $vars['theme_hook_suggestions'][] = 'page__404';
    drupal_add_css('//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css', array('type' => 'external'));
  }

  //custom 403 access denied page
  $header = drupal_get_http_header("status");
  if($header == "403 Forbidden") {
    $vars['theme_hook_suggestions'][] = 'page__403';
    drupal_add_css('//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css', array('type' => 'external'));
  }

And I have custom page--403.tpl.php and page--404.tpl.php (these don't exist as nodes)

And they work if it's non-Bootstrap theme, e.g. it works on Zen theme, but it doesn't work on Bootstrap theme. When you go to some random URL it just gives the default page not found error and doesn't load my custom pages.

And I don't get it why.

Also with Bootstrap theme you have to put your custom pages inside templates/system and put your custom functions inside page.vars.php.

1 Answer 1

0

You're using $vars instead of $variables (per conversation in IRC).

Not the answer you're looking for? Browse other questions tagged or ask your own question.