【发布时间】:2014-06-22 10:55:02
【问题描述】:
我想将博客布局上的所有介绍图片转换为文章的链接,就像阅读更多一样。 在这里找到这篇文章: 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 复制到其中并对代码进行了更改。没啥事儿。然后我尝试更改组件文件夹中的相同行,只是为了查看问题是否与模板覆盖有关,什么都没有。
还有其他方法吗?
提前致谢,
伙计。
【问题讨论】:
-
您在模板中使用了什么文件夹名称?
-
我使用了以下路径:templates/mytemplate/html/com_content/featured
-
Joomla 假设您将在图像文件夹中有图像。您只能将模板文件夹用于您希望模板使用的内容,而不是单个文章。同样对于模板,如果您想存储图像,请将它们放在模板图像文件夹中,然后 Joomla 会知道在哪里可以找到它们。