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?
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | print_button_node_tpl_php-1205254-6.patch | 1.17 KB | sheldon rampton |
Comments
Comment #1
kingswoodute commentedHi,
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.
Comment #2
ressaDrupal 7 is probably doing things a little differently, I am still using D6.
Perhaps this can get you started? http://drupal.org/node/1028858
Comment #3
kingswoodute commentedThanks 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.
Comment #4
kingswoodute commentedGot it,
This will work in Drupal 7.
print render($content['fblikebutton_field']);Thanks for your help.
Comment #5
ressaGreat! I am glad you got it working, and thank you for sharing it with the rest of the community.
Comment #6
sheldon rampton commentedSince 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.
Comment #7
gvsoWe are not fixing this issue as Drupal 6 has reached end of life
Comment #8
gvso