Joomla intro image as read more link

2019-04-28 04:19发布

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.

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>

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

7条回答
家丑人穷心不美
2楼-- · 2019-04-28 04:50

In Joomla 3.1, the intro_image layout has been moved to the layouts/joomla/content folder. In my situation, it is called from com_content/views/category/tmpl/blog_item.php like so:

<?php echo JLayoutHelper::render('joomla.content.intro_image', $this->item); ?>

I moved that file to my template/html/com_content/category/blog_item.php and then wrapped the call to JLayoutHelper like so:

<?php $link = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>
<a href="<?php echo $link; ?>">
<?php echo JLayoutHelper::render('joomla.content.intro_image', $this->item); ?>
</a>
查看更多
登录 后发表回答