Adding Facebook LIke Button Support to a Module
How to integrate Facebook Like button into a module.
1. Update the Controller by ensuring that 'facebook' is NOT within the $remove_configs array. Otherwise, the Facebook tab will never be displayed in module configuration settings to turn the feature on.
2. Update the item ‘show’ or 'showall' templates by adding the code for the optional Facebook Like button (assuming the item is referred to as $record):
{if $config.enable_facebook_like} <div id="fb-root"></div> <div class="fb-like" data-href="{$smarty.const.URL_FULL}{$record->sef_url}" data-send="false" data-width="{$config.width|default:'450'}" data-show-faces="{if $config.showfaces}true{else}false{/if}" data-font="{$config.font|default:''}"{if $config.color_scheme} data-colorscheme="{$config.color_scheme}"{/if}{if $config.verb} data-action="{$config.verb}"{/if}"></div> {script unique='facebook_src'} {literal} (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); {/literal} {/script} {/if}
Loading Help