Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

page-front.tpl.php not working

I am setting a template for the frontpage in a drupal 7 site and am having difficulty. I saved the file in the correct folder, cleared all caches, and refreshed both the theme page and browser page. Is there something I am missing? Why doesn't this work?

like image 214
EZDC Avatar asked Oct 27 '11 16:10

EZDC


2 Answers

In Drupal 7, I believe you need page--front.tpl.php -- note the two dashes.

like image 50
muffinista Avatar answered Sep 29 '22 09:09

muffinista


theme_get_suggestions(), which is called from template_preprocess_page() as theme_get_suggestions(arg(), 'page'), contains the following code:

if (drupal_is_front_page()) {
  // Front templates should be based on root only, not prefixed arguments.
  $suggestions[] = $base . $delimiter . 'front';
}

$base contains "page" and $delimiters contains "__". As the underscores are replaced with hyphens, the template filename for the front page must be page--front.tpl.php (two hyphens instead of one).

like image 26
apaderno Avatar answered Sep 29 '22 08:09

apaderno