I have page named page--news.tpl.php, which i created for my news page. But after i cleared my cache, page still not using, and drupal use the original page.tpl.php. Any ideas how to solve it?
Asked
Active
Viewed 377 times
2
-
possible duplicate of [Drupal 7 How to override page.tpl for specific content type?](http://stackoverflow.com/questions/11193910/drupal-7-how-to-override-page-tpl-for-specific-content-type) – nmc Jun 27 '12 at 12:57
-
You are putting this into a custom theme? If so, do you have page.tpl.php in the same folder as page-news.tpl.php? – Web Assistant Jun 27 '12 at 15:12
-
yes. More then my page--front.tpl hooked with no problem, but the rest just still now hooking – Avdept Jun 28 '12 at 11:32
1 Answers
3
An alternate way of doing it, is through preprocess hook with few lines of code. Here's how it goes
function <module_name>_preprocess_page(&$variables) {
if (isset($variables['node'])) {
$variables['theme_hook_suggestions'][] = 'page__'.$variables['node']->type;
}
}
Suppose you have a node type as "news" then tpl should look like 'page--news.tpl.php' and above code will handle the rest.

tashi
- 782
- 6
- 5