Chapter 16. Getting Started with Drupal Theming: Base and Child Themes

And now it’s time for the Fun Stuff: turning your design into a theme. In this chapter you’ll learn how to break down a layout for theming, choose a base theme, and create a child theme to hold your customizations. In the next chapter you’ll learn how to work with LESS to make coding CSS easier.

Breaking Down a Layout for a Drupal Implementation

The most important part of working in Drupal, particularly in terms of creating and implementing layouts for a given page, is figuring out where the content in a layout is coming from and how to manage the code that Drupal is creating. This is, arguably, the biggest difference between building sites in Drupal and building them with straight HTML. Whereas it’s fairly straightforward to mock up a page in HTML once you have an idea of what it should look like, everything that goes into your Drupal site comes from somewhere in the site’s database; your code simply tells Drupal how to render the content it pulls from that database.

Content in a Drupal layout can come from any number of places.

Nodes

Any individual piece of content, in Drupal terms, is called a node, and it’s displayed using a file called node.tpl.php. If you’re dealing with the layout of a single page and are only concerned with how the actual page content is displayed, you’re likely dealing with node.tpl.php.

While node.tpl.php can help you control certain aspects of how Drupal displays individual nodes—for example, ...

Get Drupal for Designers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.