【问题标题】:Linking intro image in Joomla 3.3.1在 Joomla 3.3.1 中链接介绍图片
【发布时间】: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 会知道在哪里可以找到它们。

标签: joomla joomla3.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>

【讨论】:

  • 非常感谢。你能告诉我文件夹覆盖路径,以便我可以适当地创建它吗?
  • 嗨,Richard,自己找到了路径,非常感谢您的帮助,效果很好。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-12-17
  • 2014-09-11
  • 2017-11-17
  • 2013-08-31
  • 1970-01-01
相关资源
最近更新 更多