Closed (fixed)
Project:
Facebook social plugins integration
Version:
6.x-1.0-beta4
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Sep 2010 at 09:17 UTC
Updated:
10 Apr 2011 at 00:20 UTC
I am trying to figure out how to place the button on a custom node page for a content type ("Artists"). I set the correct content type, set the permissions, selected the second option for displaying a cck-like field, but how do I place this into my custom "Artists" layout, or node-artists.tpl.php?
I am looking for something like
<?php print $fb-connect-like ?>
Thanks!
Comments
Comment #1
nagarajanl commentedHello,
If i understand correctly, you can do this by placing the button in the template_preprocess_node() and put it in your 'node-artists.tpl.php'. For ex)
function themeName_preprocess_node(&$variables) {
$variables['fb-connect-like'] = "" ; // place your button code here....
}
Now you can print the variable
print $fb-connect-likein your 'node-artists.tpl.php'Comment #2
sammyman commentedThanks for the quick response. I can't seem to find what the code for the button would be for this module?
Comment #3
nagarajanl commentedI think the best solution may be add the hook_form_alter for this corresponding form and place the button there by coding something like...
function hook_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'your_form_id') {
$form['customSubmit'] = array('#type' => 'submit', '#value' => 'Submit');
}
}
Not sure this what you want...
Comment #4
sammyman commentedThis looks like it will work. I still haven't figured out how to post the correct url for the button. I am trying to use this in my theme-settings.php file:
This also makes me wonder why I am using a module??? Looks like I am just working bypassing the module completely. Or am I?
Comment #5
ferdi commentedA couple of options:
or
or
Comment #6
sammyman commentedI tried each one without success. Then I tried all 3, without success.
I know other facebook apps are incompatible, and I am using facebook connect. Could that be why I am not seeing any like buttons?
Comment #7
sammyman commentedOk, it does now work when I disabled the facebook connect. BTW, option #2 above does not work, but the top and bottom ones did work well.
Comment #8
cem kaan commentedI used third one in node.tpl.php with facebook connect it works.
Comment #9
radiofranky2009 commentedHi,
I tried your code in a block, but it doesn't seems to be working. Is there something else need to be set when dealt with blocks?
this is what I tried.
print($node -> content['fb_social_like_widget']['#value']);When it's posted in .tp file, yes it works. However, the only way for this to show is to enable in the settings
print($node -> content['fb_social_like_widget']['#value']);but then if you place one at your own you will have two places showing "like".Is there a way without editing the module to show only where i want to show and without displaying the default one?
Right now I have two places showing "like". First one is the default place which is on the top of the node, and the 2nd one is the one I placed.
thanks very much.
Comment #10
yaho commentedHi, how to print fb social comment in my own node.tpl.php?
It works good until I remove $content.
Now, I have only standard drupal comment.
Thanks! :-)
Comment #11
ferdi commentedSee #5