1

Ideally I'd like to provide new classes to the body tag such a access-404 or access-denied, but unfortunately I'm not really aware of how to capture these.

I don't mind to identify these pages from the Page Title itself from template_preprocess_page, however it seems that $vars['title'] does not exist in D7? How can I access the page title from within a template_preprocess function?

SOLUTION: Thanks to DeeZone:

In my template.php:

function template_preprocess_html(&$vars){
  $status = drupal_get_http_header("status");
  switch($status){
  case "403 Forbidden":
  case "404 Not Found";
    $vars['classes_array'][] = 'drupal-page-error';
    dsm($vars);
    break;
  }
} 
2

If I uderstand your question perhaps try: Drupal 7 Custom 404 Page Template - use this method to setup a custom page template (tpl) file for your 404 page. This will give you a specific page template that you can hard code classes you're wanting - "access-404" or "access-denied" in the body tag.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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