我是初学者,我想为我的网站编写一个简单的插件,但我遇到了一些问题。
当我试图通过 div 将我的插件导入到文章中时
<div id="locker-464" class="like-dl blue"> </div>
我只得到没有js的css框架。
jimport('joomla.plugin.plugin');
$document = & JFactory::getDocument();
$document->addStyleSheet(JURI::root() . 'plugins/content/plugin/tmpl/css/style.css', 'text/css', null, array() );
$document->addScript(JURI::root() . 'plugins/content/plugin/tmpl/js/liketodownlad.js');
$document->addScript ("https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js");
$document->addScript ("http://connect.facebook.net/en_US/all.js#xfbml=1");
class plgContentLiketoDownload extends JPlugin {
function plgContentLiketoDownload( &$subject, $params )
{
parent::__construct( $subject, $params );
}
function onContentPrepare($context, &$params)
{
global $mainframe;
$app = JFactory::getApplication();
$plugin = & JPluginHelper::getPlugin('content', 'plugin');
echo "<script type=\"text/javascript\">
var $jx = jQuery.noConflict();
$jx(document).ready(function(){
$jx('#locker-464').liketodl({
download_url: 'http://website.com/sampleDownload.zip',
like_url: 'https://www.facebook.com/FBpage',
like_colorscheme: 'light'
});
$jx('#locker-564').liketodl({
download_url: 'sampleDownload.zip',
like_url: 'http://google.com',
like_colorscheme: 'list'
});
});";
</script>";
return true;
}
}
?>