2

First off I am very new to Drupal but not very new to other frameworks and CMS's (symfony, cake, codeigniter, wordpress)

So I am trying to make a theme and it seems like I want to put a lot more stuff in html.tpl.php then drupal wants me to?

Like for example $logo, why is that not available in html.tpl.php, I don't want to include that in every variation of the page template, do I?

Or should I be thinking of page.tpl.php more as the wrapper than html.tpl.php.

I basically think the page template should only display content for that page, anything around that (ie, nav, logo, footer) should be in html.tpl.php. but drupal seems to be set up opposite? Why does this feel wrong to me?

1
  • In d6 the html.tpl.php template didn't exist, they split it out so you didn't have to keep messing with the doctype and all the stuff that goes in <head>. You are right, page.tpl.php is also more of a wrapper, you should try not to have a lot of them. Are you building a theme from scratch or using a base theme? It might be better to start off by making a Zen subtheme (it is very well commented so you can learn a lot from it) or using one of the other base themes.
    – sarahjean
    Commented Oct 27, 2012 at 17:22

1 Answer 1

3

Something to keep in mind is that Drupal doesn't work with templates the way a traditional MVC framework will. Ideally you want to have as few templates as possible in your theme, i.e having only one page.tpl.php with some conditionals would be best. If you do need to split things up you can define additional templates with hook_theme() in your theme's template.php and move your header/footer section into there, but in general you'll have better results by not having lots of template variations.

1
  • Thanks, for this, i think it makes more sense now that I know its intentions vs my preconceptions. I see now its probably easier to change my ways rather than try to bend drupal to my will :-) Commented Oct 29, 2012 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.