在 joomla 联系页面中将博客图片添加到用户个人资料页面

add blog picture to user profile page in joomla contact page

我想在联系人(用户个人资料页面)的文章标题之前添加文章的图片,如下所示:

此外,我已经在模板中创建了一个 ovveride html/com_contact/contact

我添加了这段代码,但它给出了警告:

"Notice: Undefined property: stdClass::$images"

没有图像。

代码:

 / Create a shortcut for params.
$images         = json_decode($this->item->images); 
$introImage   = $images->image_intro;


?>
<?php if ($this->params->get('show_articles')) : ?>
<div class="contact-articles">
<ul class="nav nav-tabs nav-stacked">
    <?php foreach ($this->item->articles as $article) : ?>
        <li>

            <?php echo JHtml::_('link', 
JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article-
>catid, $article->language)), htmlspecialchars($article->title, ENT_COMPAT, 
'UTF-8')); ?>


            <?php echo $introImage; ?>

        </li>

我怎样才能解决这个问题?

我已经用这个 cod 修复了它;

 // Create a shortcut for params.
$article_id = $article->id; // get article id
//aticle_id = JFactory::getApplication()->input->get('id'); // get article 
id

$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('images'))
->from($db->quoteName('#__content'))
->where('id = '. $db->Quote($article_id));

$db->setQuery($query);
$result = $db->loadResult();
$intro_image = json_decode($result)->image_intro;
//var_dump($intro_image);

//echo $intro_image;
echo "<img src=\"".$intro_image."\" alt=\"icon\" >";