Joomla简介图片作为更多链接 [英] Joomla intro image as read more link

查看:102
本文介绍了Joomla简介图片作为更多链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让joomla文章的简介图片表现得像阅读更多内容和标题链接一样.因此,用户单击图像,然后加载文章.

I want to make the joomla articles intro image to behave like the read more, and the title link. So the user clicks the image, and the article loads.

我不是PHP专家,但是也许这是readmore链接代码:

I'm not an PHP expert but maybe this is the readmore links code:

<a href="<?php echo $this->item->readmore_link; ?>" class="button<?php echo $this->item->params->get('pageclass_sfx'); ?>">
        <?php if ($this->item->readmore_register) :
            echo JText::_('Register to read more...');
        elseif ($readmore = $this->item->params->get('readmore')) :
            echo $readmore;
        else :
                echo JText::_("Read Article");
        endif; ?></a>

这就是我想对joomla网站上的每个介绍图片执行的操作. 谢谢!

This is what i want to do with every intro image on my joomla site. Thanks !

推荐答案

就解决了!

您的思维方式帮助了我.谢谢!

your way of thinking helped me. Thank you!

这是我的代码:

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

    <?php
        $images = json_decode($item->images);
        if (isset($images->image_intro) and !empty($images->image_intro)) {
            $imgfloat = (empty($images->float_intro)) ? $params->get('float_intro') : $images->float_intro;
            $class = (htmlspecialchars($imgfloat) != 'none') ? ' class="size-auto align-'.htmlspecialchars($imgfloat).'"' : ' class="size-auto"';
            $title = ($images->image_intro_caption) ? ' title="'.htmlspecialchars($images->image_intro_caption).'"' : '';
            echo '<img'.$class.$title.' src="'.htmlspecialchars($images->image_intro).'" alt="'.htmlspecialchars($images->image_intro_alt).'" />';
        }

        echo $this->item->introtext;

    ?>

    </a>

这篇关于Joomla简介图片作为更多链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆