【问题标题】:Joomla 3.1 the full article image to be clickable (to self image url)Joomla 3.1 全文图片可点击(到自己的图片网址)
【发布时间】:2013-11-02 21:19:27
【问题描述】:

我发现这个 com_content/views/article/tmpl/default.php 我创建了一个模板覆盖,这里是代码:

    <?php if ($params->get('access-view')):?>
<?php if (isset($images->image_fulltext) && !empty($images->image_fulltext)) : ?>
<?php $imgfloat = (empty($images->float_fulltext)) ? $params->get('float_fulltext') : $images->float_fulltext; ?>
<div class="pull-<?php echo htmlspecialchars($imgfloat); ?> item-image"> 

<img
<?php if ($images->image_fulltext_caption):
    echo 'class="caption"'.' title="' .htmlspecialchars($images->image_fulltext_caption) . '"';
endif; ?>
src="<?php echo htmlspecialchars($images->image_fulltext); ?>" alt="<?php echo htmlspecialchars($images->image_fulltext_alt); ?>"/> </div>
<?php endif; ?>

在img标签如何形成之前,修改这个php代码,使其可以点击图片到自己的url:

<a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>"> <img

【问题讨论】:

  • 你的代码目前发生了什么?
  • 现在图片是可点击的,但是到文章的网址,但我想自己的图片网址...

标签: php image joomla joomla3.1


【解决方案1】:

这是分辨率:

<a href="<?php echo JURI::root().$images->image_fulltext; ?>">

现在图片可以“点击”到自己的网址

JURI::root() > 您的网页网址(例如:something.com) $images->image_fulltext > 在 joomla 3.1 中,您可以选择单击阅读时显示的图像,即当您阅读全文时,该图像有一个 url,例如:/images/stories/freshsite/something.jpg

这个php代码结合了这两个代码,是:something.com/images/stories/freshsite/something.jpg > 当你点击图片时,只有这个图片会显示在你的浏览器中:)

【讨论】:

  • 如果您可以添加一些关于为什么这样可以解决问题的解释,这将对未来的读者有所帮助。
猜你喜欢
  • 2015-09-06
  • 2020-01-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-09-18
  • 1970-01-01
  • 2016-07-19
相关资源
最近更新 更多