CHAPTER 5 ADDING AND CUSTOMIZING THEMES 167 (Web hosting support)
CHAPTER 5 ADDING AND CUSTOMIZING THEMES 167 The node.tpl.phpfile presents a special case, as it is responsible for handling many types of nodes. Clearly, there will be cases where a blog should use a different template than a image or a poll. To support this, PHPTemplate lets you create templates specific to one node type by using a naming convention: node-type.tpl.php. For example, you might have node-book.tpl.phpand node-story.tpl.php for book and story nodes, respectively. Create one of these files in your theme s directory (in the same directory as page.tpl.php), and from then on, views of that particular node type will be passed on to the new template. Occasionally, modules will provide their own node template for the particular node type in question. An example of this is provided by the Organic Groups module, which was discussed in Chapter 4. Listing 5-5 shows the template file for group nodes. Notice that it is greatly simplified and leaves out many things that are not relevant for a group s node. Listing 5-5. node-og.tpl.php
Page.tpl.php The page.tpl.phpfile is the template that will handle calls to theme(’page’, $content). This call is the last thing that happens in the series of events leading up to a Drupal page being served. That places this template in the special position of defining the overall layout of the pages for your site. This is where you lay down the big picture. It also has the special distinction of being the only file that a PHPTemplate theme is required to provide. It is easily the most important and most complex of all the standard tpl.php files, as can be seen by the number of variables and the amount of code it contains. Table 5-8 lists the variables available in page.tpl.php. Table 5-8. Variables Available in page.tpl.php Variable Description $breadcrumb HTML that renders the breadcrumb links. $closure Normally contains client-side scripts that need to be included at the bottom of the page, thus is always the last thing to be printed before the closing