• Joseph
  • Joseph's Avatar
  • OFFLINE
  • New Member
  • Posts: 18

[SOLVED] Can we have "Introtext word limit" 5 years 3 months ago #104700

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
  • Lefteris
  • Lefteris's Avatar
  • OFFLINE
  • Moderator
  • Posts: 9660

Re: Can we have "Introtext word limit" 5 years 3 months ago #104701

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/
  • Joseph
  • Joseph's Avatar
  • OFFLINE
  • New Member
  • Posts: 18

Re: Can we have "Introtext word limit" 5 years 3 months ago #104702

Hi...

Thanks a lot for your reply, but could you please tell me where do I exactly put that code?
  • Phil G
  • Phil G's Avatar
  • OFFLINE
  • New Member
  • Posts: 15

Re: Can we have "Introtext word limit" 5 years 2 months ago #104703

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.
  • Phil G
  • Phil G's Avatar
  • OFFLINE
  • New Member
  • Posts: 15

Re: Can we have "Introtext word limit" 5 years 2 months ago #104704

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 :)
  • Phil G
  • Phil G's Avatar
  • OFFLINE
  • New Member
  • Posts: 15

SOLVED Re: Can we have "Introtext word limit" 5 years 2 months ago #104705

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

Re: SOLVED Re: Can we have "Introtext word limit" 5 years 2 months ago #104706

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); ?>
  • maiky
  • maiky's Avatar
  • OFFLINE
  • Junior Member
  • Posts: 33

Re: Can we have "Introtext word limit" 4 years 2 months ago #104707

hello i think you verry much for your post i was looking for since many day and you save me
AJMG

Re: [SOLVED] Can we have "Introtext word limit" 3 years 3 months ago #104708

Worked for me. Thanks for sharing the solution ;)
Moderators: william white

Who Is Online

Total users online: 4 Members and 4723 Guests Online
Happyfeat Jaime Villegas Jim Papas Tim Allan
Legend ::   Site Administrator Global Moderator Moderator Banned User Guest
  • Total Messages: 139353 | Total Subjects: 36637
  • Total Sections: 6 | Total Categories: 32
  • Today Open: 0 | Yesterday Open: 3
  • Today Total Answer: 0 | Yesterday Total Answer: 10
Powered by Kunena Forum