CHAPTER 5 (Anonymous web server) ADDING AND CUSTOMIZING THEMES 159

CHAPTER 5 ADDING AND CUSTOMIZING THEMES 159 Exercise 5-1. Theme Breadcrumb Links Try your hand at overriding a themable function for the Bluemarine theme. Create a new file on your web server in the folder themes/bluemarine called template.php. Copy the following short code segment into the template.php file. Don t forget the .

Hello World!

‘; $output .= implode(’ / ‘, $breadcrumb); return $output; } ?> In the unaltered Bluemarine theme, breadcrumb links are separated using the character. This is the default HTML that is generated by Drupal. By including the phptemplate_breadcrumb function in the Bluemarine theme, the default HTML will no longer be used; instead, the HTML generated by the new function will be used. The phptemplate_breadcrumb function not only separates the breadcrumb links with a different character, but it also outputs a meaningful and original message directly above them. Click through some pages on your site and you will see the result. You have successfully altered the default HTML for breadcrumbs from this:

to this:

Hello World!

Home / create content Using Template Files In Exercise 5-1, you saw how a function could be written to override a themable function. As useful as this is, generating HTML from within functions can be very tiresome work. PHPTemplate makes the process of creating themable functions much easier and modular by introducing template files. The required file page.tpl.php is one such template file that will be used whenever theme(’page’) is called. This template must be provided by the theme itself. Other template files are provided by the PHPTemplate engine. These include block.tpl.php, box.tpl.php, comment.tpl.php, and node.tpl.php (see Figure 5-5 earlier in the chapter). These files override the block, box, comment, and node themable functions, respectively. If any of these four files appear in your theme folder alongside page.tpl.php, they will override the version in themes/engines/phptemplate. The template files are completely reusable; you could trade and mix the five standard tpl.php files between themes and expect, at a minimum, that they will be called at the appropriate time. Furthermore, since they are include files and not functions, you can write all the
Note: In case you are looking for affordable webhost to host and run your servlet application check Vision make web site services

Leave a Reply