Ok, this is really winding me up. I am new to Drupal 7 and have been asked to check it out as we might use it to replace an aging Joomla site. I like what I see but can't get the darn theme override to work so that I can have different tpl files for different pages.
I have:
sites/all/themes/pp7/templates/page-front.tpl.php
sites/all/themes/pp7/templates/page-next.tpl.php [with a menu link to [site]/next]
sites/all/themes/pp7/templates/page.tpl.php [default but overriden from core]
Now neither of the first two are working. Doesn't matter how many times I clear cache or check the URLs the system is just not picking up the overides. The only one which works is the default page.tpl.php
This is contrary to everything I have read about Drupal 7 but it just ain't playing ball and after a day of trying to get it working I am stumped.
Can someone please shed some light on this? Thanks.
Comments
I'm not a great themer and
I'm not a great themer and haven't touched Drupal 7 yet for themeing but my first thought is that you have the tpl files in the wrong directory. In my drupal 6 sites I had the tpl pages directly under the theme folder. Not in a templates folder.
I just took a look at the Drupal 7 and Drupal 6 default themes and I could see why you would put them in the templates folder since the default theme does that. Perhaps this is a change in Drupal 7. But looking at the garland theme in both Drupal 7 and Drupal 6, the tpl files are under the main theme folder (pp7 for your theme).
Hope that helps.
In Drupal 7 theming you need
In Drupal 7 theming you need to use two hyphens instead of one as the delimiter when overriding generic templates - page--front instead of page-front.
See this for more info: http://drupal.org/update/theme/6/7#template_files_double_hyphen
thanks for your reply. I have
thanks for your reply. I have already tried using the double dash '--' but still not working. I am following the instructions from a few tutorials and the book by Apress 'Pro Drupal 7 Development' but nothing is working.
This is why I have a love-hate relationship with free open-source software. The documentation is soooo poor and even the books are wrong. What is obvious to the authors is NOT obvious to people picking up Drupal for the first time.
I have a virgin-fresh installation of Drupal 7. I have changed nothing other than add my own theme folders and yet the supposed simple instructions to override the default page.tpl.php are just plain garbage.
I guess it is a case of sticking with what I know and not moving to Drupal if the theming system is this poor. A pity because the rest of it is very intuitive and well constructed.
You theme directory is shown
You theme directory is shown as "pp7", what theme are you using?
I am having similar problems.
I am having similar problems. The page overrides are being loaded(located in 'themename/templates') but only page.tpl.php and page--front.tpl.php render properly. It appears that my 3rd override, page--home.tpl.php doesn't have all the $page variables available to it. In particular $page('content') acts as if it is empty. I have verified the pages are being loaded. I have filed a bug report( http://drupal.org/node/1030720 ) but no response yet.
ps.I use ?q=home to load the 3rd page. How are you calling yours?
ps.ps. I verified by copying system/page.tpl.php to my theme, doing appropriate renames, and adding an appropriate 'H1' to the top of each to show which page is loaded. Only page--home failed to render properly on load even though it is essentially identical to the other 2. Using 7.x dev dated 01/14.
David Rocks
Or u can't find anything in
Or u can't find anything in documentation...
http://drupal.org/node/1036164