Keyword

Item listed by tag, long intro text needs to be limited

  • Coyote
  • Coyote's Avatar Topic Author
  • Offline
  • New Member
More
7 years 9 months ago #154850 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:
<?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
  • JoomlaWorks Support Team's Avatar
  • Offline
  • Elite Member
More
7 years 9 months ago #154852 by JoomlaWorks Support Team
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.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Coyote
  • Coyote's Avatar Topic Author
  • Offline
  • New Member
More
7 years 9 months ago #154869 by Coyote
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:
<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
  • JoomlaWorks Support Team's Avatar
  • Offline
  • Elite Member
More
7 years 9 months ago #154874 by JoomlaWorks Support Team
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.


Powered by Kunena Forum