Posts Tagged ‘Drupal’

How to Customize the Syndicate Feed Icon Block in Drupal

August 25th, 2009

For a recent project I needed to customize the feed icon in the Drupal theme I was creating. This wasn’t as straight forward as I thought it would be. Being the drupal newbie that I am I went looking for it in the core templates and suggestions page only to come empty handed.

Previously I found the solution to theming a search form by using the search-block-form.tpl.php template file and thought there would be one for the feed icon too. I found the solution to this in the function reference in the form of a theme hook.

theme_feed_icon($url, $title)

This function is internally called by drupal to generate the feed icon in the Syndicate block. Our Job is to override this function.

Customizing the feed icon

We cannot redefine the same function in our theme so we must define a phptemplate function to override the default implementation.

function phptemplate_feed_icon($url,$title)

What It Must Do?

This function must return the code of the feed icon. Therefore instead of using a image, you may also use a text link as well as hard code a few options such as Subscribe via Twitter and E-Mail.

Therefore, to use your own subscribe by RSS icon, you may use a function similar to the following:

function phptemplate_feed_icon($url,$title)
{
	global $base_path;
	$path = path_to_theme();
 $feed_icon = '<a href=" '. check_url($url).'" class="feed-icon"><img src="'. $path.'/images/rss-header.png" /></a>';
        return $feed_icon;
}

This function is very simple . It just returns a image which is linked to the $url parameter of the function. This function is to be placed in the template.php file.

Summary

  • Syndicate feed icon is customized using the theme_feed_icon template function.
  • We use phptemplate_feed_icon($url,$title)  in our function to customize the syndicate feed icon block.
  • The function should return the code of the syndicate feed block. This code may also include links to other services such as twitter and subscribing by e-mail.
  • The function should be placed in your template.php file.

How To Install Drupal On Your Shared Hosting Server.

May 23rd, 2009

Drupal is the best content management system I have ever come across. It has all the features necessary to build any website. Drupal can save you thousands of dollars in development costs by simplifying the development of complex applications and portal websites. The drupal community has created thousands of plugins which can be configured to achieve any functionality desired in a content management system. This article will show you how to install Drupal on your shared hosting server. This article will show you how to install drupal in a shared hosting server.

» Read more: How To Install Drupal On Your Shared Hosting Server.