- Posts: 2
COMMUNITY FORUM
How to use Read More button only when needed?
- Lizetta
- Topic Author
- Offline
- New Member
Less
More
12 years 1 week ago #104019
by Lizetta
How to use Read More button only when needed? was created by Lizetta
I don't want the read more button to show for every article, only for those where there actually is more to read. In Joomla that is how it works, but I've been working on migrating all of my articles into K2 and noticed that it shows on every item, regardless of whether its applicable or not. I know how to hide it, but then it doesn't show when there actually is more to read.
Am I missing something? I really appreciate the help, and this forum!
Am I missing something? I really appreciate the help, and this forum!
Please Log in or Create an account to join the conversation.
- Lefteris
- Offline
- Moderator
Less
More
- Posts: 8743
12 years 1 week ago #104020
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Lefteris on topic Re: How to use Read More button only when needed?
Hi. You can apply a check to your layout files to see if an item has more content.
Note that the example is taken from the category_item.php. You can modify accordingly the rest layouts.
<?php if($this->item->fulltext):?>
<?php if ($this->item->params->get('catItemReadMore')): ?>
<!-- Item "read more..." link -->
<div class="catItemReadMore">
<a class="k2ReadMore" href="<?php echo $this->item->link; ?>">
<?php echo JText::_('K2_READ_MORE'); ?>
</a>
</div>
<?php endif; ?>
<?php endif; ?>
Note that the example is taken from the category_item.php. You can modify accordingly the rest layouts.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Lizetta
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
12 years 1 week ago #104021
by Lizetta
Replied by Lizetta on topic Re: How to use Read More button only when needed?
Thank you - now where do I find the component_item.php file to add this to? And what other layout files should I add it to?
sorry - very new at this, obviously
sorry - very new at this, obviously
Please Log in or Create an account to join the conversation.
- Lefteris
- Offline
- Moderator
Less
More
- Posts: 8743
12 years 1 week ago #104022
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Lefteris on topic Re: How to use Read More button only when needed?
It seems that you need to take a read on K2 templating at getk2.org/documentation/tutorials/item/174-templating-with-k2-and-the-concepts-of-sub-templates
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.