Customizing SMF > Modifications and Packages

Advance Facebook Like button with OpenGraph (For Each Post)

<< < (24/30) > >>

Dan_y2k:
Don't think so...

This will require me to use more settings (depends on the mod), hold my fingers crossed that it will get updated when a new version of SMF 2 comes out, make people register (my community is pretty public, so it's not a must-have to register), and probably won't show up the specific posts on Facebook, which what I needed from the start...

Arantor:
*shrug* You can't have what you want.

distrue:
Having issues getting this to work with custom theme premiummgc

After uploading the package successfully, when you click install all checks are positive, except for the index.template in my custom theme. Of the checks it does, the only one it errors on is :

Fine

// the upshrink image, right-floated


add before

            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

this theme does not have that section.

After comparing the index.template from this custom theme to the one from default theme, I see that the package is just trying to paste in this code after the:

function template_body_above() , which is is this custom theme index.template file.

I attempted to paste in the above FB code right after function template_body_above()
{
   global $context, $settings, $options, $scripturl, $txt, $modSettings;

But no luck. The facebook icons do not show up at all in either the default theme, which had no errors, or the custom theme I was attempting to modify

Any help would be greatly appreciated!

distrue:
Update Ricky:

I am attempting to manually modify my index.template of this custom theme. You noted on an earlier post what code needs to be pasted into the header of a custom index.template file, so I did this.

I found:

function template_body_above()
{
   global $context, $settings, $options, $scripturl, $txt, $modSettings;
   
   echo'
   

<div id="header"><div class="frame">
      <div id="top_section">
         <h1 class="forumtitle">
            <a href="', $scripturl, '">', empty($context['header_logo_url_html_safe']) ? '<img src="'. $settings['images_url'].'/theme/logo.png" alt="' .$context['forum_name']. '"/>' : '<img src="' . $context['header_logo_url_html_safe'] . '" alt="' . $context['forum_name'] . '" />', '</a>
         </h1>
         <br class="clear"/>
         
         <div class="news normaltext">';

And made it:

function template_body_above()
{
   global $context, $settings, $options, $scripturl, $txt, $modSettings;
   
   echo'
   

<div id="header"><div class="frame">
      <div id="top_section">
         <h1 class="forumtitle">
            <a href="', $scripturl, '">', empty($context['header_logo_url_html_safe']) ? '<img src="'. $settings['images_url'].'/theme/logo.png" alt="' .$context['forum_name']. '"/>' : '<img src="' . $context['header_logo_url_html_safe'] . '" alt="' . $context['forum_name'] . '" />', '</a>
         </h1>
         <br class="clear"/>
         
         <div class="news normaltext">';

            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>';

And now I get a parse error. Any ideas? Could really use help to get this working. thanks

distrue:
Error is:

Template Parse Error!
There was a problem loading the /Themes/premiummgc/index.template.php template or language file. Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\). To see more specific error information from PHP, try accessing the file directly.

You may want to try to refresh this page or use the default theme.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version