If you are printing your variables in a customized node.tpl.php, for example like this <?php print $node->content['body']['#value'] ?> in stead of with <?php print $content ?>, you can use this to output the Facebook Like Button:
<?php print $node->content['fblikebutton_button']['#value'] ?>

Perhaps it could go into the documentation, with a note that you need to visit the permissions page to let anonymous users access the FB Like button?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kingswoodute’s picture

Version: 6.x-1.6 » 7.x-1.2

Hi,

When using this code: print $node->content['fblikebutton_button']['#value']

On a custom node.tpl.php file I get the following error;

Notice: Undefined property: stdClass::$content in include()

I get the same problem when I'm trying to use TweetMeeme. Has there been a change in syntax or am I missing something ridiculously obvious?

Thanks so much for your help.

ressa’s picture

Drupal 7 is probably doing things a little differently, I am still using D6.
Perhaps this can get you started? http://drupal.org/node/1028858

kingswoodute’s picture

Thanks so much for your help,

I suspected it may be a change between 6 and 7 that was the issue.

I'll try what they suggest and if I find the answer I'll post it.

Thanks again.

kingswoodute’s picture

Got it,

This will work in Drupal 7.

print render($content['fblikebutton_field']);

Thanks for your help.

ressa’s picture

Great! I am glad you got it working, and thank you for sharing it with the rest of the community.

Sheldon Rampton’s picture

Version: 7.x-1.2 » 6.x-2.x-dev
Component: Documentation » Code
Category: task » feature
Status: Active » Needs review
FileSize
1.17 KB

Since there appears to be an easy way to do this in Drupal 7, I'm reassigning this issue ticket to 6.x-2.x-dev and am attaching a patch I wrote that provides this functionality in D6. After applying my patch, all you have to do is add the following line of code to your node.tpl.php file:

<?php print $fblikebutton; ?>

I also fixed a minor bug that added a bit of unnecessary overhead to the module, by requiring the module to check for $op == 'view' before adding the button to a node.

gvso’s picture

Issue summary: View changes

We are not fixing this issue as Drupal 6 has reached end of life

gvso’s picture

Status: Needs review » Closed (won't fix)