Chapter 9. Breaking Down a Layout for Drupal Implementation

The two most important parts of working in Drupal, in terms of creating and implementing layouts for a given page, are figuring out where the content in a given 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 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, if you want to move the page title, or change the markup that controls the node’s container—if your content type has custom fields, as many content types do, you’ll want to manage those in the Manage Display tab, available by going into the admin area for your content type. From there, you can manage how fields are organized on the page, ...

Get Design and Prototyping for Drupal 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.