Joomla 3.1 intro image as read more link(Joomla 3.1 介绍图片作为阅读更多链接)
问题描述
在 joomla 3.1 中我编辑了这个文件 componentscom_contentviewsfeatured mpldefault_item.php
image_intro) && !empty($images->image_intro)) : ?><?php $imgfloat = (empty($images->float_intro)) ?$params->get('float_intro') : $images->float_intro;?><div class="pull-<?php echo htmlspecialchars($imgfloat); ?> item-image"><img<?php if ($images->image_intro_caption):echo 'class="caption"'.'title="' .htmlspecialchars($images->image_intro_caption) .'"';万一;?>src="<?php echo htmlspecialchars($images->image_intro); ?>"alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>"/><?php endif;?>
到:
image_intro) && !empty($images->image_intro)) : ?><?php $imgfloat = (empty($images->float_intro)) ?$params->get('float_intro') : $images->float_intro;?><div class="pull-<?php echo htmlspecialchars($imgfloat); ?> item-image"><a href="<?php echo $this->item->readmore_link;?>"><img<?php if ($images->image_intro_caption):echo 'class="caption"'.'title="' .htmlspecialchars($images->image_intro_caption) .'"';万一;?>src="<?php echo htmlspecialchars($images->image_intro); ?>"alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>"/></a>
<?php endif;?>`
但它无法正常工作,因为正在链接到主页......我该如何解决这个问题,我尝试了所有方法,但它不起作用Joomla 介绍图片作为阅读更多链接
首先,你不应该编辑核心文件.与其编辑 componentscom_contentviewsfeatured mpldefault_item.php
,您应该复制文件并将其放在此处 - /templates/YOUR TEMPLATE/html/com_content/featured/default_item.php
.
这将防止 Joomla 在更新/升级时覆盖任何更改.这可能也是您在网站上看不到更改的原因.componentscom_contentviewsfeatured mpldefault_item.php
的模板覆盖很可能已经存在于您的模板文件夹中.如果有,Joomla 将使用该文件而不是您正在编辑的核心文件.在模板覆盖中进行更改,它应该会起作用.
In joomla 3.1 I edited in this file componentscom_contentviewsfeatured mpldefault_item.php
<?php if (isset($images->image_intro) && !empty($images->image_intro)) : ?>
<?php $imgfloat = (empty($images->float_intro)) ? $params->get('float_intro') : $images->float_intro; ?>
<div class="pull-<?php echo htmlspecialchars($imgfloat); ?> item-image"> <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); ?>"/> </div>
<?php endif; ?>
to:
<?php if (isset($images->image_intro) && !empty($images->image_intro)) : ?>
<?php $imgfloat = (empty($images->float_intro)) ? $params->get('float_intro') : $images->float_intro; ?>
<div class="pull-<?php echo htmlspecialchars($imgfloat); ?> item-image"><a href="<?php echo $this->item->readmore_link; ?>"> <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> </div>
<?php endif; ?>`
but its not working correct, because is linking to the main page... how I can fix this, I tried everything from this, but it does not work Joomla intro image as read more link
First of all, you should never edit a core file. Instead of editing componentscom_contentviewsfeatured mpldefault_item.php
, you should make a copy of the file and place it here - /templates/YOUR TEMPLATE/html/com_content/featured/default_item.php
.
This will prevent Joomla from overwriting any changes when there is an update/upgrade. This is probably also why you are not seeing the change on your site. There is very likely a template override for componentscom_contentviewsfeatured mpldefault_item.php
already in your template folder. If there is, Joomla will use that file instead of the core file you are editing. Make your changes in your template override and it should work.
这篇关于Joomla 3.1 介绍图片作为阅读更多链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Joomla 3.1 介绍图片作为阅读更多链接
基础教程推荐
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- 在多维数组中查找最大值 2021-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01