Drupal 'facebook social' like views field

Kevin's picture
Facebook

Q: How can I include a facebook like button from the '[url=http://drupal.org/project/fb_social]Facebook social plugins integration[/url]' module in a view as a field, the module doesn't seem to have views integration?
A: Install the '[url=http://drupal.org/project/views_customfield] Views Custom Field[/url]' module, create a new PHP field in your view and then include the PHP code that follows...

The Facebook Social module is handy for placing Facebook like and share buttons on your content, but at the moment it doesn't have any views integration. So to include a like button field in your view, you must resort to some trickery!

First install the '[url=http://drupal.org/project/views_customfield]Views Custom Field[/url] module, this allows you to define fields whose output is computed using PHP, this is one of _the_ most useful modules ever!!

Next add a new 'Customfield: PHP code' field to your view, and paste the following code into it:


$url = url('node/'.$data->nid, array('absolute' => TRUE));

return theme('fb_social_like_widget', $url);

?>

All things being equal, this should add a facebook like button to your view...

Share this post: 

Recent Work

Some of Ireland's biggest brands use Pride Design to Design, Build, Manage, Market and Maintain their websites.

Website design for St.Patricks Credit Union in Dublin, Including Loan Calculators.

Website design and development for a step by step wedding and other stationary ordering website f

New website designed and developed for Cork's newest café, which is based in Merchants Quay in Co

New Website design for Pain Relief clinic based in Cork City.

Website for a busy Dublin city centre pub.

We redrafted the Ballymaloe house website to modernise the look and feel of the site and to also

We revamped the website for the Ballymaloe Cookery School.

We revamped the Cully & Sully website onto Drupal.

Rachel Allen was brought up in Dublin and left home at eighteen to study at the world-famous Ball

Clóna Dairy Products are a Dairy Company based in Clonakilty, Co. Cork, since 1919.

Project Arts Centre is Ireland’s leading centre for the presentation and development of c