- Posts: 3
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- Item listed by tag, long intro text needs to be limited
Item listed by tag, long intro text needs to be limited
- Coyote
- Topic Author
- Offline
- New Member
Less
More
7 years 9 months ago #154850
by Coyote
Item listed by tag, long intro text needs to be limited was created by Coyote
Hello,
I am trying to limit the intro text on a menu I made which links to show "items by tag". I found the info below on another post but I could not get it to work. I need a little bit further info to understand what to do. Many thanks in advance
This is the function you need:
Where 5 is the limit.
The complete code that should replace the default in item.php would be:
I am trying to limit the intro text on a menu I made which links to show "items by tag". I found the info below on another post but I could not get it to work. I need a little bit further info to understand what to do. Many thanks in advance
This is the function you need:
<?php echo K2HelperUtilities::wordLimit($item->introtext, 5); ?>
Where 5 is the limit.
The complete code that should replace the default in item.php would be:
<?php if($this->item->params->get('itemRelatedIntrotext')): ?>
<div class="itemRelIntrotext"><?php echo $item->introtext; ?></div>
<?php endif; ?>
Please Log in or Create an account to join the conversation.
- JoomlaWorks Support Team
- Offline
- Elite Member
Less
More
- Posts: 169
7 years 9 months ago #154852
by JoomlaWorks Support Team
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks Support Team on topic Item listed by tag, long intro text needs to be limited
Hello,
You need to modify tag.php template file as if I understand correctly you are trying to limit the text in a K2 item list filtered by a tag.
You need to modify tag.php template file as if I understand correctly you are trying to limit the text in a K2 item list filtered by a tag.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Coyote
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
7 years 9 months ago #154869
by Coyote
Replied by Coyote on topic Item listed by tag, long intro text needs to be limited
Hi,
Thank you very much. Pointing out this was the key which helped. So I changed tag.php in K2 template in this way:
The default is this:
An I changed it to this where 40 is the words limit:
Thanks once again. Case solved.
Thank you very much. Pointing out this was the key which helped. So I changed tag.php in K2 template in this way:
The default is this:
<div class="itemIntroText"> <?php echo $item->introtext; ?> </div>
An I changed it to this where 40 is the words limit:
<div class="itemIntroText"> <?php echo K2HelperUtilities::wordLimit($item->introtext, 40); ?> </div>
Thanks once again. Case solved.
Please Log in or Create an account to join the conversation.
- JoomlaWorks Support Team
- Offline
- Elite Member
Less
More
- Posts: 169
7 years 9 months ago #154874
by JoomlaWorks Support Team
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks Support Team on topic Item listed by tag, long intro text needs to be limited
You 're welcome Coyote.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Forum
- K2 Community Forum
- English K2 Community
- Item listed by tag, long intro text needs to be limited