I use the Drupal 7 on my website. I have two page.tpl.php files, one for the homepage and the other for the internal content pages. But I have a question:

- What's the naming convention about the page.tpl.php file of homepage and the internal content pages's? How do I rename these files according it?


deruitern’s picture

Use page-front.tpl.php if you need a customized template for the homepage. There should also be a CSS class "front" applied to the home page and a class "not-front" on non-home pages. You can use those if the changes you are making are visual only.

VM’s picture

drupal 7 uses double hypens. page--front.tpl.php for example. see: http://drupal.org/node/1089656

spyout98’s picture

Which is the correct naming convention for homepage page.tpl.php file: "page-front.tpl.php", "page--front.tpl.php", "front-page.tpl.php" or "front--page.tpl.php?

Remenber: I'm using DRUPAL 7.

VM’s picture

as previously stated in the comment above and documented in http://drupal.org/node/1089656 for D7: the proper template suggestion for a front page is page--front.tpl.php

for your convenience, note the bold text:

base template: page.tpl.php
The suggestions are numerous. The one that takes precedence is for the front page. The rest are based on the internal path of the current page. Do not confuse the internal path to path aliases which are not accounted for. Keep in mind that the commonly used Path auto module works its magic through path aliases.

The front page can be set at "Administration > Configuration > System > Site information." In Drupal 6, at "Administrator > Site configuration > Site information." Anything set there will trigger the suggestion of "page--front.tpl.php" for it.

The list of suggested template files is in order of specificity based on internal paths. One suggestion is made for every element of the current path, though numeric elements are not carried to subsequent suggestions. For example, "http://www.example.com/node/1/edit" would result in the following suggestions:

Also see page.tpl.php in the Drupal API documentation for more information.