News:

Want to get involved in developing SMF? Why not lend a hand on our GitHub!

Main Menu

Advance Facebook Like button with OpenGraph (For Each Post)

Started by Ricky., October 15, 2011, 09:50:15 AM

Previous topic - Next topic

Ricky.

Well, lets try afresh, in your Themes/premiummgc/index.template.php
Code (find) Select

</h1>
<br class="clear"/>


Replace with
</h1>';
if(!empty($modSettings['e_fb_enable']) && $context['current_action'] != 'admin'){
// Advance FB like with OG
echo '<span style="float: right; margin-top: 10px;"><div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    FB.init({appId: \'',(empty($modSettings['e_fb_appId'])?'your app id':$modSettings['e_fb_appId']),'\', status: true, cookie: true,
             xfbml: true});
  };
  (function() {
    var e = document.createElement(\'script\'); e.async = true;
    e.src = document.location.protocol +
      \'//connect.facebook.net/en_US/all.js\';
    document.getElementById(\'fb-root\').appendChild(e);
  }());
</script>
<fb:like send="false" layout="button_count" width="100" show_faces="false" font=""></fb:like></span>';
} // Advance FB like with OG

echo ' <br class="clear"/>


I have tested and worked as expected.

distrue

Hi Ricky,

Thanks for the reply. The modification you suggested took away the parse error, however FB like or send does not show up anywhere on any page. In the admin the check boxes are selected to show the like and send buttons.

What can I do to help you help me make this work? Do you need to see the files used?

I appreciate your help

Ricky.

I suggest you to uninstall the MOD (but keeping the changes done on index.template.php of premiummgc theme and install it again and let me know.

distrue

I did as you requested, keeping the last change you instructed me to make to index.template in the custom theme, uninstall then reinstall, and no such luck. Still nothing.

Would you like me to post certain files to review? If so please just let me know which ones.

I appreciate your time in this

Ricky.

post your index.template.php as well as post screenshot of your admin area..
Here what I suspect that you may not be editing right file..

distrue

Hi Ricky,

I am attaching my index.template file from my custom theme directory, and an image of the admin area. Any help is greatly appreciated!



Ricky.

You need to enable first option too, that is overall switch to turn it ON/OFF

distrue


distrue

Did you notice anything else that would be preventing this from showing up in my code? I am attaching the default/display.template also for review


distrue

No such luck checking that box.



I attached my display.template.php from the default theme directory and here is the index.template from my custom theme again

Any ideas why this isnt showing up?

distrue


Ricky.

I don't see instance of my FB mod in your Display.template.php , I am not sure but looks like mod is not being installed properly. May be you can send me your forum details in PM so that I can see myself whenever I have some free time.

thermus

I am trying to get this installed on a custom theme. Everything works until this point...

This is code is not found...

Code: (Find)
Quote// the upshrink image, right-floated

Which means I am not sure where to paste...

Code: (Before)
Quoteif(!empty($modSettings['e_fb_enable']) && $context['current_action'] != 'admin'){   
            // Advance FB like with OG
               echo '<span style="float: right; margin-top: 10px;"><div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    FB.init({appId: \'',(empty($modSettings['e_fb_appId'])?'your app id':$modSettings['e_fb_appId']),'\', status: true, cookie: true,
             xfbml: true});
  };
  (function() {
    var e = document.createElement(\'script\'); e.async = true;
    e.src = document.location.protocol +
      \'//connect.facebook.net/en_US/all.js\'; [nofollow]
    document.getElementById(\'fb-root\').appendChild(e);
  }());
</script>
         <fb:like send="false" layout="button_count" width="100" show_faces="false" font=""></fb:like></span>';
            } // Advance FB like with OG
   

I attached my index.template.php. Can someone tell me where I should paste this in so I can get it working?

Ricky.

It is not possible to suggest location without seeing theme live also, since you are using custom theme, it will be very easy for custom theme author to suggest you location.

thermus

toyotaoutlaws.com [nofollow] is the website. I would be happy to give you login info if you can possibly help me out on this on...  O:)

Ricky.

I just checked your index.template.php and looks like you have added but it is overlapped by other elements.
I am attaching modified index.template.php , remember to take backup of your current file as this code is not tested as I don't have this theme with me.

techguy

I want users on my site to click on like us and only then certain article would be visible

Ricky.

That is something different than what this mod offer, what you asked can be done but that will be something completely new, I can try but only when I get time.

kkattfish

Using helios multi theme and i cannot get the like buttons or anything to show up. 
i have manually attempted to add the files and still nothing. 

my index.template.php and display.template.php are attached if you can help me out. 
below is also a screen shot of the settings.  in misc.




techguy

Quote from: Ricky. on November 04, 2012, 02:28:51 PM
That is something different than what this mod offer, what you asked can be done but that will be something completely new, I can try but only when I get time.

Please do I when u get time
Thanks for your efforts

Advertisement: