Keyword

[SOLVED] IntroText words limit not working while selecting

More
11 years 3 months ago #66745 by Jofeltje
Thank you so much!!!!!!!

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

More
11 years 3 months ago - 11 years 3 months ago #66746 by Russell English
Replied by Russell English on topic Re: IntroText words limit not working while selecting
I was looking for a similar solution to this, but wanted to limit the category intro text (rather than the item intro text).

The solution was:

Go to your relevant template folder (in this case we'll use default):

/components/com_k2/templates/default

and open category.php

find the following:
<?php if($this->params->get('subCatDescription')): ?>
<!-- Subcategory description -->
<?php echo $subCategory->description; ?>
<?php endif; ?>

and replace with the following:
<?php if($this->params->get('subCatDescription')): ?>
<!-- Subcategory description -->
<?php echo K2HelperUtilities::wordLimit($subCategory->description,30); ?>
<?php endif; ?>

The 30 above is the word limit. Hope this helps

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

More
11 years 2 months ago #66747 by M@tin
It really works. Say "OM SHANTI" for Manoj.. :woohoo: :evil: :whistle: :silly: :sick:

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

More
11 years 2 months ago #66748 by Florian Ughetto
Replied by Florian Ughetto on topic Re: IntroText words limit not working while selecting
Hello !

Ouah ! that's working like a charm ! However do you know how to don't get the world limit when you're in the normal page ?

Coz now i also have to click on read more when I should be on the normal page.

Tks a lot !

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

  • v.v. SVA Assendelft
  • v.v. SVA Assendelft's Avatar
  • Offline
  • New Member
  • Webmaster
More
10 years 11 months ago #66749 by v.v. SVA Assendelft
Replied by v.v. SVA Assendelft on topic Re: IntroText words limit not working while selecting
OM SHANTI

This solution works well with K2 2.6.6 !! Thnx very much Manoj!

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

More
10 years 6 months ago - 10 years 6 months ago #66750 by Marius Olbert
Replied by Marius Olbert on topic Re: IntroText words limit not working while selecting
Thanks it also works with Joomla 3.0.3 Stable

P.S. OM SHANTI :)

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

More
10 years 2 months ago #66751 by Tariq
This solution work very fine for me,
My question now, Why this did not inserted by K2 developers if its really important by default?

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

  • Syed Raza Imam Naqvi
  • Syed Raza Imam Naqvi's Avatar
  • Offline
  • New Member
More
9 years 5 months ago #134567 by Syed Raza Imam Naqvi
Replied by Syed Raza Imam Naqvi on topic Re: IntroText words limit not working while selecting
Great Solution for the issue but I have question

I have implemented your solution but when I am trying to view any item...................item is only showing introText instead Full text. What is the solution for this?

Regards

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

More
9 years 5 months ago #134571 by JoomlaWorks
This solution is simply calling an internal function in K2 for enforcing a word limit to any text field output. If you want to limit your introtext, look in the category settings. No need to touch any code.

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

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

  • Syed Raza Imam Naqvi
  • Syed Raza Imam Naqvi's Avatar
  • Offline
  • New Member
More
9 years 5 months ago - 9 years 5 months ago #134589 by Syed Raza Imam Naqvi
Replied by Syed Raza Imam Naqvi on topic Re: IntroText words limit not working while selecting
I got the solution.

When we are showing items from more than 1 category K2 is not showing introText, to handle this issue Manoj has given the solution but I have modified it. Because Manoj Solution also limiting body text to introText when viewing Item.

Step 1. Open file item.php at location \components\com_k2\models\
Step 2. Find following line :
if ($item->params->get('catItemIntroTextWordLimit') && $task == 'category')

Step 3. Replace it with following :
if ($item->params->get('catItemIntroTextWordLimit') && ($view == 'itemlist' && ($task == 'category' || $task == 'user' || $task == 'tag' || $task == 'date' || $task == 'search' || $task == 'itemlist' || $task == '' )))

After this hack K2 will show items from multiple categories with introText and when you will try to see single Item, K2 will show item with fullText.
Last edit: 9 years 5 months ago by Syed Raza Imam Naqvi.

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


Powered by Kunena Forum