[drupal-support] adding some links in blog page

k_imes dir.dev at digitalreef.net
Fri Aug 12 17:00:44 UTC 2005


hi Jad - 

>i'm trying to add some more links on each blog page 
>so under these links 
>Jad's blog | add new comment | 29 reads
>( categories: Daily | Jordan | Life )
>
>I want to add  - Google for similar topics - Wikipedia Search
>
>but I couldn't figure out which file I have to edit to add those custom links 
>I have tried blog.module, page.module, node.module but nothing there 
>also I have checked the theme files, so please someone direct me

I think the place you want to look is in the modules/blog.module file.
The blog_link() function is what adds links to the bottom of blog entries 
(only). Here's a code snippet from Drupal 4.6.2's blog.module:

- - - - - - - - - - - - - - -
function blog_link($type, $node = 0, $main = 0) {
  $links = array();

  if ($type == 'node' && $node->type == 'blog') {
    if (arg(0) != 'blog' && arg(1) != $node->uid) {
      $links[] = l(t("%username's blog", array('%username' => 
$node->name)), "blog/$node->uid", array('title' => t("Read %username's 
latest blog entries.", array('%username' => $node->name))));
      $links[] = '<a href="http://www.google.com">Google me!</a>'; 
    }
  }

  return $links;
}
- - - - - - - - - - - - - - -

The links[] array hold all the links that will be displayed at the bottom 
of the blog. I added the second "$links[] = ..." statment above (with the 
google link) to show an example of how you might add links of your choice.

Cheers,
--Katin






More information about the drupal-support mailing list