I'm new to Joomla and in the progress of developing a little module, that should display the intro-image of the article that is shown by the "com_article" component. The module should be a widget in a kind of sidebar, that's what it is for. I already searched the web and played around with JSite, but didn't get the data i was looking for.

How do i get the images uri?

Kind regards,

André

有帮助吗?

解决方案

I finally found the answer:

$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);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top