Enable "read more" button

September 2015 Joomla Template
GK User
Tue Jan 19, 2016 5:36 am
Hi
I'm trying to enable "read more" button. Read more button is enabled in settings, but it seams the template is banning it from display? How to overcome it? http://rossannels.com/index.php/atwork/chairs
read_more_newstech.png

Many thanks
User avatar
Expert Boarder

teitbite
Fri Jan 22, 2016 11:18 am
Hi

Please edit /html/com_content/category/blog_item.php and add 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;
      $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)); ?>

<?php endif; ?>


under:

Code: Select all
      <div class="item-intro-text">
         <?php echo $this->item->introtext; ?>
      </div>
User avatar
Moderator

GK User
Mon Jan 25, 2016 7:29 am
I can add your code to the default_items.html file (above or at the bottom) which originally looks like this :
Code: Select all
<?php if (count($this->items[$this->parent->id]) > 0 && $this->maxLevelcat != 0) : ?>
<ul>
<?php foreach($this->items[$this->parent->id] as $id => $item) : ?>
   <?php if ($this->params->get('show_empty_categories_cat') || $item->numitems || count($item->getChildren())) : ?>
   <li>
      <a href="<?php echo JRoute::_(ContentHelperRoute::getCategoryRoute($item->id));?>">
         <?php echo $this->escape($item->title); ?>
      </a>

      <?php if ($this->params->get('show_subcat_desc_cat') == 1 && $item->description) : ?>
      <div>
         <?php echo JHtml::_('content.prepare', $item->description, '', 'com_content.categories'); ?>
      </div>
        <?php endif; ?>

      <?php if ($this->params->get('show_cat_num_articles_cat') == 1) :?>
      <dl>
         <dt><?php echo JText::_('COM_CONTENT_NUM_ITEMS'); ?></dt>
         <dd><?php echo $item->numitems; ?></dd>
      </dl>
      <?php endif; ?>

      <?php if(count($item->getChildren()) > 0) :
         $this->items[$item->id] = $item->getChildren();
         $this->parent = $item;
         $this->maxLevelcat--;
         echo $this->loadTemplate('items');
         $this->parent = $item->getParent();
         $this->maxLevelcat++;
      endif; ?>

   </li>
   <?php endif; ?>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php endif; ?>

I see no class="item-intro-text", just confused with your "Under" reference. Thanks for explaining!
Also, once I update your template in future, the html modification might be lost, correct?
User avatar
Expert Boarder

teitbite
Mon Feb 01, 2016 11:53 am
Hi

There has to be "item-intro-text" in this file. Without it You will not be able to see the text for this article.

Yes, You will need to remember to keep this file on side while updating and overwrite it again after.
User avatar
Moderator

GK User
Thu Feb 04, 2016 4:44 am
Thank you, you're correct I was editing the wrong HTML file.
To clarify for others "after" means "insert after this code".
User avatar
Expert Boarder

teitbite
Wed Feb 10, 2016 2:14 pm
Hi

Yes, exactly :) Happy You've done it. Closing this thread now.
User avatar
Moderator


cron