Add read more link / button to Joomla category
Rate this topic: 




3.50 out of 6 based on 2 vote(s)






- GK User
- Mon Aug 31, 2015 3:24 pm
- Reply with quote
- Report this post
Hi there,
I'm trying to re-add a read more button in category view of Joomla, but the result is a white screen.
The blog_item.php in HTML/com_content/category doesn't have the code. I've tried to add the original code as part of the <div>, right after the code which generates the introtext.
Who can help me?
I'm trying to re-add a read more button in category view of Joomla, but the result is a white screen.
The blog_item.php in HTML/com_content/category doesn't have the code. I've tried to add the original code as part of the <div>, right after the code which generates the introtext.
- Code: Select all
<?php if ($params->get('show_readmore') && $this->item->readmore) :
if ($params->get('access-view')) :
$link = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language));
else :
$menu = JFactory::getApplication()->getMenu();
$active = $menu->getActive();
$itemId = $active->id;
$link = new JUri(JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId, false));
$link->setVar('return', base64_encode(JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language), false)));
endif; ?>
<?php echo JLayoutHelper::render('joomla.content.readmore', array('item' => $this->item, 'params' => $params, 'link' => $link)); ?>
Who can help me?
-
- Junior Boarder
- teitbite
- Wed Sep 02, 2015 2:14 pm
- Reply with quote
- Report this post
Hi
A code for read more should be much longer. Try this:
A code for read more should be much longer. Try this:
- Code: Select all
<?php if ($params->get('show_readmore') && $this->item->readmore) :
if ($params->get('access-view')) :
$link = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language));
else :
$menu = JFactory::getApplication()->getMenu();
$active = $menu->getActive();
$itemId = $active->id;
$link1 = JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId);
$returnURL = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language));
$link = new JUri($link1);
$link->setVar('return', base64_encode($returnURL));
endif; ?>
<?php echo JLayoutHelper::render('joomla.content.readmore', array('item' => $this->item, 'params' => $params, 'link' => $link)); ?>
<?php endif; ?>
-
- Moderator
- GK User
- Tue Sep 08, 2015 10:20 am
- Reply with quote
- Report this post
teitbite wrote:Hi
A code for read more should be much longer. Try this:
- Code: Select all
<?php if ($params->get('show_readmore') && $this->item->readmore) :
if ($params->get('access-view')) :
$link = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language));
else :
$menu = JFactory::getApplication()->getMenu();
$active = $menu->getActive();
$itemId = $active->id;
$link1 = JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId);
$returnURL = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language));
$link = new JUri($link1);
$link->setVar('return', base64_encode($returnURL));
endif; ?>
<?php echo JLayoutHelper::render('joomla.content.readmore', array('item' => $this->item, 'params' => $params, 'link' => $link)); ?>
<?php endif; ?>
Cheers, I'll try!
-
- Junior Boarder
- GK User
- Tue Sep 08, 2015 1:51 pm
- Reply with quote
- Report this post
It works!
I've added the code in blog_item.php in the folder /templates/gk_news2/html/com_content/category right under
So, it looks like this:
I've added the code in blog_item.php in the folder /templates/gk_news2/html/com_content/category right under
- Code: Select all
<?php echo $this->item->introtext; ?>
- Code: Select all
</div>
So, it looks like this:
- Code: Select all
<?php echo $this->item->introtext; ?>
<?php if ($params->get('show_readmore') && $this->item->readmore) :
if ($params->get('access-view')) :
$link = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language));
else :
$menu = JFactory::getApplication()->getMenu();
$active = $menu->getActive();
$itemId = $active->id;
$link1 = JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId);
$returnURL = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language));
$link = new JUri($link1);
$link->setVar('return', base64_encode($returnURL));
endif; ?>
<?php echo JLayoutHelper::render('joomla.content.readmore', array('item' => $this->item, 'params' => $params, 'link' => $link)); ?>
<?php endif; ?>
</div>
-
- Junior Boarder
- teitbite
- Thu Sep 10, 2015 10:12 am
- Reply with quote
- Report this post
Hi
Great to hear that. Thank You for the detailed explanation. I'm gonna tag this thread in case someone else will be looking an answer to this question.
Great to hear that. Thank You for the detailed explanation. I'm gonna tag this thread in case someone else will be looking an answer to this question.
-
- Moderator
5 posts
• Page 1 of 1