I am building an audio component and for social media buttons I'm trying to get it to work with the JFBconnect system plugin.
What I'm trying to accomplish is that when a user clicks on a "Share" button an Ajax call will call an external file containing the JFBconnect plugin tags. The output (Like buttons) have to be shown in a div.
I got the Ajax call right (at least it calls the file and pushes the output to the div)...
Quote:
window.addEvent('domready', function(){
$('ajax-replace').addEvent('click', function(event) {
//prevent the page from changing
event.stop();
//make the ajax call, replace text
var req = new Request.HTML({
method: 'get',
url: 'components/com_cooltracks/assets/lib/social.php?format=raw',
data: { 'do' : '1' },
onRequest: function() { alert('Request made. Please wait...'); },
update: $('message-here'),
onComplete: function(response) { alert('Request completed successfully.'); $('message-here').setStyle('background','#fffea1');
}
}).send();
});
This is the code in the external file...
Code:
<?php
//init Joomla Framework
define( '_JEXEC', 1 );
define( '_VALID_MOS', 1 );
define( 'DS', DIRECTORY_SEPARATOR );
define( 'JPATH_BASE', realpath(dirname(__FILE__).'/../../../..' ));
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$mainframe = JFactory::getApplication('site');
JPluginHelper::importPlugin('system');
$dispatcher = &JDispatcher::getInstance();
$dispatcher->trigger('onBeforeDisplayContent');
?>
{JFBCLike href=http://www.sourcecoast.com layout=standard show_faces=true show_send_button=true width=300 action=like font=verdana colorscheme=light}
This will output the system tag "{JFBCLike href=http://www.sourcecoast.com…}" and not the actual plugin output.
I've been searching for days to get this to work and with the little info I can find my code should work. I'm hoping someone could shine a light on why it doesn't.