As I'm teaching some friends the basics of Drupal I see a common mistake, putting too much functionality into the theme. The real problem with this is simple: the site's look and feel may change with or without the site's functionality. If you're using a custom theme, it's tempting to throw functionality right into page.tpl.php and call it a day. But you're setting yourself up for headaches. Trust me, I know from experience.
Once upon a time, I embedded views directly into my page template. It was simple, easy to do, and gave me the result I wanted. But when the designer handed me a brand new design it meant I had to manually move all of the views logic into the new theme... maybe that's not such a big deal but it felt ugly. If I had just put those views into blocks and created a region for it, I would have saved time.
Use Regions!
Most themes have 4 or 5 basic regions. Header, footer, left, right, content. But there's no limit to how many you can have. You can have one called "banana" if you want. All you need to do is put the region definition in your theme's .info file and
<?php print $banana; ?>
anywhere in your page.tpl.php file and you're done! Now you can assign blocks to that region and keep your code modular.
Use modules!
Modules are great! How many times did I look at the Google Analytics module and thing "man, that's stupid... why wouldn't I just put the JS in my page.tpl.php and forget about it?" Well, when your design changes and you forget to move that Google Analytics code you'll know that you should have just used the module. In addition, that module also gives you more integrated tracking and drupal specific features.
Recent comments
1 week 3 days ago
2 weeks 2 days ago
2 weeks 2 days ago
11 weeks 6 days ago
12 weeks 1 day ago
12 weeks 1 day ago
14 weeks 8 hours ago
19 weeks 2 days ago
28 weeks 2 days ago
34 weeks 5 hours ago