Exercise 51 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 <?php and ?>.

<?php function phptemplate_breadcrumb($breadcrumb) { $output = '<h1>Hello World!</h1>'; $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:

<div class="breadcrumb">

<a href="?q=" >Home</a> &raquo; <a href="?q=node/add" >create content</a> </div>

to this:

<a href="?q=" >Home</a> / <a href="?q=node/add" >create content</a>

Make Money Writing

Make Money Writing

This Report Will Show You How To Make Money By Providing Writing Services To Other Internet Marketers. Learn how to make money by writing the right way. Grab your copy of this report now and learn. Why writing is a great way to earn money. How to compete with cheap writers, even if you charge a lot more money.

Get My Free Ebook

Post a comment