0

I guess this is more of a "Drupal way" question than a technical question. I have a multi-site install with a base-theme shared by all of the sites. The base theme has two 'page' theme files (one is specifically for the homepage). As you can imagine, there are shared elements to the layout (let's say a header and footer for conciseness). I'd like to keep the 'header' and 'footer' in separate PHP files so that I have one place to edit them versus going into 2 separate files and editing four blocks of code if something changes.

What is the appropriate way to create php files for 'header' and 'footer' and include them in the page.tpl and page--homepage.tpl templates?

Should they be in a folder called includes with a .inc extension, should this not be done at all, etc..?

  • 3
    That isn't how Drupal does things so whatever way you want to do it is fine. Don't forget your template files are PHP, so you can just include – Clive Apr 29 '14 at 15:02
  • 2
    If these are regions, then they already have their own .tpl.php template suggestions. – mpdonadio Apr 29 '14 at 15:03
  • @Clive Right...I planned on just using include statements, but I didn't know if there was a specific "Drupal way" of doing things like naming the include a specific way or whatever. Thanks. If you add your comment as an answer, I'll be happy to mark it "correct" for posterity. – kevindeleon Apr 29 '14 at 15:14
-1

I think the "Drupal Way" would be to create a variable in your template.php file, and then just call the variable in your page theme.

http://drupalize.me/videos/overview-templatephp

| improve this answer | |

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.