我写访问K2表,如K2项目和K2类别一个Joomla模块。我已成功地拉出K2项目我从MySQL数据库显示希望,但我希望能够创建一个可点击的链接到K2项目或其K2范畴。我无法找到这些信息。我查看了K2项目模板,但如果我尝试使用相同的代码进行链接,它不包含完整路径。它遗漏了http://和域。Joomla K2链接到模块中的类别或项目?
正在打造的Joomla不是如何链接必须为一个Joomla文章或Joomla类别中创建不同的链接到K2项目或K2类别?无论哪种方式,我如何在Joomla模块中为K2 Items和K2 Categories创建一个。
这里是我从K2的Joomla使用PHP代码示例:
$db = & JFactory::getDBO();
$category = & JTable::getInstance('K2Category', 'Table');
$category->load($catid);
$item->category=$category;
$item->category->link = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($category->id.':'.urlencode($category->alias))));
echo $item->category->link;
这打印出的路径,但它不包括域名。 /joomla/index.php/component/k2/itemlist/category/4-something-here 我很期待它打印出在这个例子中,使之成为有效的链接类别: http://example.com/joomla/index.php/component/k2/itemlist/category/4-something-here