Keyword

[SOLVED] Can we have "Introtext word limit"

  • Joseph
  • Joseph's Avatar Topic Author
  • Offline
  • New Member
More
5 years 8 months ago - 5 years 8 months ago #104700 by Joseph
Joseph created the topic: [SOLVED] Can we have "Introtext word limit"
In the K2 Parameters, Content Tab has a field to enter "Item Introtext word limit". Can we also have "Item Introtext word limit on Layout & view options for user (author) pages, Layout & view options for tag listings, Layout & view options for Search & Date listings as well please?

Regards,
Joseph

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

More
5 years 8 months ago #104701 by Lefteris
Lefteris replied the topic: Re: Can we have "Introtext word limit"
Hi. Thanks for your recommendations. You can also implement this by your own by placing a piece of code like the follwoing in your overrides:
<?php echo K2HelperUtilities::wordLimit($YOUR_VARIABLE, 100); ?>

IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

---
JoomlaWorks
www.joomlaworks.net/

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

  • Joseph
  • Joseph's Avatar Topic Author
  • Offline
  • New Member
More
5 years 8 months ago #104702 by Joseph
Joseph replied the topic: Re: Can we have "Introtext word limit"
Hi...

Thanks a lot for your reply, but could you please tell me where do I exactly put that code?

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

More
5 years 7 months ago - 5 years 7 months ago #104703 by Phil G
Phil G replied the topic: Re: Can we have "Introtext word limit"
I need to do the same for my menu items containing
K2 ┬╗ Latest items from (one or more) users or categories.


Also I've noticed that if I have a K2 Categories menu with multiple categories it suffers from the same problem :(

Currently they're both ignoring the Introtext word limit I've imposed on my master category.

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

More
5 years 7 months ago #104704 by Phil G
Phil G replied the topic: Re: Can we have "Introtext word limit"
Take a look at this thread : getk2.org/community/New-to-K2-Ask-here-first/152649-How-Fix---Introtext---Word-limit-for-multiple-categories

and also this article on templating:
getk2.org/documentation/tutorials/item/174-templating-with-k2-and-the-concepts-of-sub-templates

I suggest you create a personal template which you can modify and test without messing up the default templates.

That's what I'm currently doing, will report back once I've got it working :)

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

More
5 years 7 months ago #104705 by Phil G
Phil G replied the topic: SOLVED Re: Can we have "Introtext word limit"
I solved my problem by:
  1. copying the the K2 templates folder to my Joomla folder: templates/myJoomlaTemplate/html/com_k2/
  2. Copying the default folder (I called mine blog)
  3. I then edited the category_item.php file to have the follwong code for displaying the item introtext:

<?php if($this->item->params->get('catItemIntroText')): ?>
	  <!-- Item introtext -->
	  <div class="catItemIntroText">
	  	<!-- <?php echo $this->item->introtext; ?> -->
		<?php echo K2HelperUtilities::wordLimit($this->item->introtext, 50); ?>
	  </div>
	  <?php endif; ?>

Andit works like a charm B)

I imagine you can accomplish the same thing for the other template files that can be found in the same folder. like user.php, tag.php, and latest.php

Good luck,

Phil

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

  • Voiceconnect Internet Solutions
  • Voiceconnect Internet Solutions's Avatar
  • Offline
  • Junior Member
More
5 years 7 months ago #104706 by Voiceconnect Internet Solutions
Voiceconnect Internet Solutions replied the topic: Re: SOLVED Re: Can we have "Introtext word limit"
Thanks Phil - what i needed but only not in the category_item.php but in my latest_item.php where i replaced
<?php echo $this->item->introtext; ?>
with your code
<?php echo K2HelperUtilities::wordLimit($this->item->introtext, 50); ?>

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

More
4 years 7 months ago #104707 by maiky
maiky replied the topic: Re: Can we have "Introtext word limit"
hello i think you verry much for your post i was looking for since many day and you save me

AJMG

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

More
3 years 8 months ago #104708 by Stuart Claggett
Stuart Claggett replied the topic: Re: [SOLVED] Can we have "Introtext word limit"
Worked for me. Thanks for sharing the solution ;)

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

Moderators: william white