我想让 joomla 文章介绍图像表现得像阅读更多和标题链接。因此,用户点击图像,文章加载。
我不是 PHP 专家,但也许这是阅读更多链接代码:
<a href="<?php echo $this->item->readmore_link; ?>" class="button<?php echo $this->item->params->get('pageclass_sfx'); ?>">
<?php if ($this->item->readmore_register) :
echo JText::_('Register to read more...');
elseif ($readmore = $this->item->params->get('readmore')) :
echo $readmore;
else :
echo JText::_("Read Article");
endif; ?></a>
这就是我想对我的 joomla 网站上的每张介绍图片执行的操作。 谢谢!
最佳答案
刚刚解决了!
你的思维方式对我有帮助。谢谢!
这是我的代码:
<a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>">
<?php
$images = json_decode($item->images);
if (isset($images->image_intro) and !empty($images->image_intro)) {
$imgfloat = (empty($images->float_intro)) ? $params->get('float_intro') : $images->float_intro;
$class = (htmlspecialchars($imgfloat) != 'none') ? ' class="size-auto align-'.htmlspecialchars($imgfloat).'"' : ' class="size-auto"';
$title = ($images->image_intro_caption) ? ' title="'.htmlspecialchars($images->image_intro_caption).'"' : '';
echo '<img'.$class.$title.' src="'.htmlspecialchars($images->image_intro).'" alt="'.htmlspecialchars($images->image_intro_alt).'" />';
}
echo $this->item->introtext;
?>
</a>
关于php - Joomla 介绍图片作为阅读更多链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9615015/