Home > Tools > CMS > Drupal > Drupal Hacks > Add an Interactive yigg.de Button in Your Theme

Add an Interactive yigg.de Button in Your Theme

yigg.de is a German language social news community that resembles digg.com in many aspects. To add an interactive yigg.de button (also see diggthis), I added the following code in my theme:

in template.php add

<?php
function mytheme_yiggbutton($nid) {
 
$url = url('node/'.$nid, NULL, NULL, TRUE);
$output =<<<EOF
<div class="yiggbutton">
  <script>
    yigg_url = '
$url';
  </script>
  <script src="http://yigg.de/emb_ycount.js"></script>
</div>
EOF;

  return
$output;
?>

in node.tpl.php add

<?php
if ($page != 0 && in_array($node->type, array('blog','video','image'))) {
    print
mytheme_yiggbutton($node->nid);
}
?>

This will display the yigg.de button if the node is a blog, a video or an image.

Live Example

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <br> <img> <h2> <h3> <h4> <h5>

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.