我有一个我正在处理的自定义组件,我正在编写一个在管理区域中运行的导入脚本.我有以下代码:
$newUrl = ContentHelperRoute::getArticleRoute($import->article_id.':'.$import->alias, $import->catid);
$newUrl = JRoute::_($newUrl);
Run Code Online (Sandbox Code Playgroud)
第一部分工作返回类似于此:
?的index.php选项= com_content&视图=文章&ID = 45:的Joomla-交际和 - sharethis模块&CATID = 18
第二部分显示如下:
/administrator/index.php?option=com_content&view=article&id=45:joomla-sociable-and-sharethis-module&catid=18
以上两个网址都是您希望组件com_content呈现这些网址,就好像我想在管理区域中使用它们一样.
知道如何强制JRoute像在前端使用时那样工作吗?
注意:这是在我的组件的控制器中使用,如果它有任何区别,我包括require_once(JPATH_SITE.'/ component/com_content/help /route.php');
我目前有以下方法创建一个"共享网址",基本上是在应用程序中插入onclick =""的代码.
问题是,现在我们已经不再拥有Facebook FBML应用程序,只有iframe - 我现在需要包含一个库才能使其工作吗?或者我应该更改代码,我已经使用Google搜索,但答案是广泛的不确定或后退,以迫使它工作.
public function getShareUrl($title, $url, $caption, $description, $imageSrc, $shareButtonText = 'Share your thoughts!')
{
$url .= "var attachment = {
'name':'$title',
'href':'$url',
'caption':'$caption',
'description':'".$description."',
'media':[{
'type':'image',
'src':'$imageSrc',
'href':'$url'
}]
};
var actionLinks = [{
'text':'Join the app now',
'href':'$url'
}];
Facebook.streamPublish('', attachment, actionLinks, null, '$shareButtonText');
return false;";
return $url;
}
Run Code Online (Sandbox Code Playgroud)
谢谢大家!:)