0

Back in Drupal 6, if I wanted to create a sub-theme for a bunch of pages, I could make a special pages-subtheme.tpl.php page and this would handle not only the /subtheme page, but also /subtheme/page1, /subtheme/page2, /subtheme/sub-subpage/page3 etc...

With the changes to Drupal 7, I could be wrong, but it looks like I have to do this node by node. And it also looks like I can't use the pathauto paths...

Thus those same 3 nodes which in Drupal 6 were pages-subtheme.tpl.php become in Drupal 7 three distinctly themed pages--node--40.tpl.php, pages--node--57.tpl.php, pages--node--23.tpl.php etc...

I'm hoping I'm wrong about this, which is why I'm asking

3

Would it help you to create a tpl.php page based on the node itself or by content-type? For example, you'd have your main page.tpl.php, but then for specific content types (subtheme), you'd have a page--content-type.tpl.php or node--type.tpl.php.

If you plan the sitemap and templates carefully beforehand you should be able to avoid creating individual page--node--1.tpl.php, etc.

Check out: https://drupal.org/node/1089656 (Drupal Theme Hook Suggestions)

The hook suggestions normally require a template_page_preprocess() function, but once you have it set up you're good to go.

I think you're right about pathauto paths not working for .tpl.php names, but you might be able to write your own preprocess function to accommodate those.

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.