在Joomla 3.3.1中链接介绍图像

时间:2014-06-22 10:55:02

标签: joomla joomla3.0

我想将博客布局上的所有介绍图像转换为文章的链接,就像阅读更多内容一样。 在这里发现这篇文章: Joomla 3.1 intro image as read more link

此处的解决方案是从以下位置替换default_item.php中的代码:

<img
     <?php if ($images->image_intro_caption):
        echo 'class="caption"'.' title="' .htmlspecialchars($images->image_intro_caption) .'"';
     endif; ?>
     src="<?php echo htmlspecialchars($images->image_intro); ?>" alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>"/>

对此:

<a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>"><img
     <?php if ($images->image_intro_caption):
        echo 'class="caption"'.' title="' .htmlspecialchars($images->image_intro_caption) .'"';
     endif; ?>
     src="<?php echo htmlspecialchars($images->image_intro); ?>" alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>"/> </a>

按照说明,在我的模板中添加了一个覆盖文件夹,将default_item.php复制到它并对代码进行了更改。没啥事儿。然后我尝试更改组件文件夹中的相同行,只是为了查看问题是否与模板覆盖,没有。

还有另一种方法吗?

提前致谢,

盖。

1 个答案:

答案 0 :(得分:1)

default_item.php仅用作精选文章视图的一部分。如果您使用的是博客视图,则文件将显示在com_content / views / category /

图像本身是在第35行的com_content / views / category / blog_item.php下生成的

<?php echo JLayoutHelper::render('joomla.content.intro_image', $this->item); ?>

将此更改为(通过模板覆盖)

<a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>">
<?php echo JLayoutHelper::render('joomla.content.intro_image', $this->item); ?>
</a>
相关问题