Expose a Block in a Views display - Social Media Share Bar

Events happening in the community are now at Drupal community events on www.drupal.org.
ahimsauzi's picture

Hi Everyone!

Since this is my first LA Drupal discussion, please forgive me if this is the wrong place for such post...

I have been working on a social media share bar for a blog I am working on.
Facebook and Twitter buttons open a post to window.
Comments button shows number of comments and will jump to anchor tag on the node.
Email button opens email program with a link and generic message.

I used views with row style set to node to display all posts as a home page with comments on the individual node only.
The code I have works if directly added to node.tpl.php but ignored(nothing is showing up) if I add it to a block and print it to the node.

I tried to use fields as row style but the comment counter feature does not work.
Any suggestion on how to incorporate the following code in a more Drupal way?

I think that this is a great functionality for today's blogs. Hopefully with some help from you guys I can offer this to the rest of the community.

Thanks,

Uzi

Here is the code (screen shot of finished bar is included also):

<ul class="mediabar">
<li><a href="http://twitter.com/home?status=Currently reading <?php $curr_url ="http://" .$_SERVER['HTTP_HOST'] .$_SERVER['REQUEST_URI']; echo $curr_url; ?>" title="" class="mb_twitter">Twitter</a></li>
<li><a name="fb_share" type="icon_link" share_url="<?php $curr_url = "http://" .$_SERVER['HTTP_HOST'] .$_SERVER['REQUEST_URI'];  echo $curr_url; ?>">Facebook</a></li>
<li><a class="mb_comments" href="<?php print $base_path . $node_url; ?>#commentBox"><?php $all = comment_num_all($node->nid);
$comms = $all ? format_plural($all, 'comment', 'comments') : t('Comments');
  print
$output . $comms . ' (' . $all . ')';
?>
</a></li>
<li><a href="mailto:?subject=I thought you may like this post.&body=<?php $curr_url = "http://" .$_SERVER['HTTP_HOST'] .$_SERVER['REQUEST_URI'];  echo $curr_url; ?>" class="mb_email">Email</a></li>
</ul>

Theme development

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: