I would like to have my Digg service link at the top of my node body and my Yahoo Buzz at the bottom.

Is there a function I can use so I can display just one service link?

Comments

TheCrow’s picture

Status: Active » Needs review

You could add something like this in your node.tpl.php or page.tpl.php:

if (isset($node->service_links) && (!empty($node->service_links))) {
  $item['service-links-twitter'] = $node->service_links['service-links-twitter'];
  print theme('links', $item);
}
vidra’s picture

How can this be used in drupal 7.x?

TheCrow’s picture

Things changed a little:

  1. first of all you have to generate your template variable, so you need a preprocess function on your template.php (you may find more examples on the template.php file attached to Service Links);
  2. then you may use the second API available for render a single service (look the documentation page for more details);
  3. the variable can be used on your theme wherever you want.
// subst themename with the name of your theme.
function themename_preprocess_node(&$vars) {
  if (module_exists('service_links')) {
    if (user_access('access service links') && service_links_show($vars['node'])) {
      // generate a $digg variable on node.tpl.php
      $vars['digg'] = service_links_render_some('digg', $vars['node'], FALSE);
      // generate a $twitter variable on node.tpl.php
      $vars['twitter'] = service_links_render_some('twitter', $vars['node'], FALSE);
    }
  }  
}
TheCrow’s picture

Component: User interface » Documentation
Status: Needs review » Closed (fixed)