php - Joomla 介绍图片作为阅读更多链接

标签 php joomla joomla1.5

我想让 joomla 文章介绍图像表现得像阅读更多和标题链接。因此,用户点击图像,文章加载。

我不是 PHP 专家,但也许这是阅读更多链接代码:

<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 网站上的每张介绍图片执行的操作。 谢谢!

最佳答案

刚刚解决了!

你的思维方式对我有帮助。谢谢!

这是我的代码:

        <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>

关于php - Joomla 介绍图片作为阅读更多链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9615015/

相关文章:

php - 我在 Google App Engine 上运行 PHP - 如何使用数据库?

php - 从 Joomla 3.2+ 中的另一个数据库访问数据

javascript - 在 Joomla 3.x 中通过 POST 将数组从 javascript 发送到 php

html - 'li' + float 使 Internet Explorer 6 崩溃

php - caching_sha2_password mysql错误

php - 如何更改 JSON 请求 Cakephp 3 的错误响应结构

ajax - 尝试将 Joomla 版本 3.5.1 升级到 3.6.4 时出现  "ERROR: AJAX Loading Error: Forbidden"错误

Joomla 主菜单 html 输出

php - 重新创建/找到 Joomla/Community Builder 'Latest Users' 模块。 MySQL/Joomla 中的日期

php - 插入数据库的字符串不完整