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.
相关文章