在模块中获取文章介绍图像


Get articles intro-image in Module

我是Joomla的新手,正在开发一个小模块,它应该显示由"com_article"组件显示的文章的介绍图像。该模块应该是侧边栏中的小部件,这就是它的用途。我已经在网上搜索并玩了JSite,但没有得到我想要的数据。

如何获取图像 URI?

亲切问候

安德烈

我终于找到了答案:

$articleId = JFactory::getApplication()->getRouter()->getVar("id");
$db = JFactory::getDbo();
$query = $db->getQuery(true)
        ->select($db->quoteName('images'))
        ->from($db->quoteName('#__content'))
        ->where('id = '. $db->Quote($articleId));
$db->setQuery($query);
$result = $db->loadResult();
$images = json_decode($result);