Facebook JS Loader plugin enables your site toย dynamically link and initialize Facebook JavaScript SDK.ย Thusย you can utilize XFBML tag in your site. This plugin is targetedย for Joomla extension developers that want to connect their site withย Facebook community.ย 

Joomlant Facebook JavaScript Loader Documentation

Joomlant Facebook JavaScript Loader, as you know is a Joomla! 1.5/Joomla! 1.6/1.7 system plugin. It will be run on 'onAfterRender' event, which will injected code to initialize and link to Facebook JavaScript. This code as suggested by Facebook will be after the <body> tag of the document. To inject code or not the plugin will check if document is HTML and in frontend as well as one variable in JApplication object called 'FacebookJSCallCount'. If this variable is more than one, code is injected.

Installation

To install the plugin is simple, just using Joomla! installer in the backend. After installation, you have one parameter required to fill in. It is a Facebook Application ID for your site. To get this Application ID, go the Facebook Developers web site, and create one application for your site. Fill Connect URL with your site 's URL, for example http://www.joomlant.org. Record the Application ID and fill in the plugin parameter, enable the plugin.

The code below is what it is injected after the body tag, replacing 'your app id' with the one you have filled in.

<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
  FB.init({appId: 'your app id', 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>

How to use it

To use it in your extensions e.g. plugin you to do 2 things.

  • Add following tag values in <html> tag of the current template. Looking for index.php in templates folder and insert this into it. There may be some property value in this tag, leave them as it is, just add the followingย 
xmlns:og="http://opengraphprotocol.org/schema/"ย xmlns:fb="http://www.facebook.com/2008/fbml" 
  • To enable plugin to inject code you have to set or increase the value of 'FacebookJSCallCount' in JApplication object. This is what you have to do.
$application = & JFactory::getApplication();
$callcount = $application->get('FacebookJSCallCount',0);
$application->set('FacebookJSCallCount', $callcount+1)

This is all required by the plugin, now you can easily enbale your site, article or blog to become OpenGraph node by using XFBML tag. For example, <fb:like  /> to displayย Facebook like button. Please take a look at Facebook site.

JS Loader for Joomla! 1.6/1.7 was released on January 2012.

You are here: Home Extensions Facebook JS Loader

© Copyright 2007-2012, All Rights Reserved by Joomlant.org. The Joomla!® name is used under a limited license from Open Source Matters in the United States and other countries. Joomlant.org is not affiliated with or endorsed by Open Source Matters or the Joomla!® Project.