Keyword

[SOLVED] How to limit introtext on multi-category menu page

  • Sean Carney
  • Sean Carney's Avatar Topic Author
  • Offline
  • Premium Member
More
11 years 9 months ago #101157 by Sean Carney
In a perfect world, I would like to try to use the intro-text in a separate data entry field from the body text.

Can K2 separate intro text from body text fields? Somehow I thought I had seen this recently but not remembering if that was core Joomla or my JCE editor or part of K2.

Can I limit the number of characters in the introtext of K2 Items when they are part of a menu linking to multiple categories:

I found this is very easy to do with any one, singular category. But, I have not figured out how to do it with multiple category menu items:

Here is a single category page where I have limited the introtext to 150 characters:
life.drcarney.com/activities/engine-2-medical-director/2011-september-immersion

Here is a multi-category menu item where I have not been able to figure out how to limit the amount of characters in the introtext:
life.drcarney.com/activities/engine-2-medical-director

Any pointers will be very much appreciated!

Thank you, Sean Carney

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

  • Sean Carney
  • Sean Carney's Avatar Topic Author
  • Offline
  • Premium Member
More
11 years 9 months ago #101158 by Sean Carney
My my... no replies... :-(

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

More
11 years 9 months ago #101159 by Lefteris
Hi. Regarding the seperation of introtext and fulltext K2 has an option for that. You can find it under K2 Parameters. Regarding the introtext word limit, it is not supported on multiple categories but you may want to take a look at getk2.org/community/New-to-K2-Ask-here-first/13197-IntroText-words-limit-not-working-while-selecting

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

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

  • Sean Carney
  • Sean Carney's Avatar Topic Author
  • Offline
  • Premium Member
More
11 years 9 months ago #101160 by Sean Carney
Thank you for the reply. i finally changed all my menu items to no longer use multi-category and so I have the control I need within the category itself. The only place I have problems is the home page because i try to show something from everywhere but I may need to get a module from somebody to do that. Thank YOU FOR THE LINK YOU PROVIDED.

Sean

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

More
11 years 9 months ago #101161 by Lefteris
You can always use word limit functionality in your template by using something like that :
echo K2HelperUtilities::wordLimit($item->introtext, 10);

This will apply a 10 word limit to the introtext. So if you have a template override for the frontpage you can use a little code to achieve what you want.

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

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

More
11 years 9 months ago #101162 by william white
Replied by william white on topic Re: How to limit introtext on multi-category menu page
@Lefteris - Nice trick. is there a listing of functions that can be used in overrides somewhere or should i just read the code?

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

More
11 years 8 months ago #101163 by Spyros Petrakis
Replied by Spyros Petrakis on topic Re: How to limit introtext on multi-category menu page
Hi Lefteris i tried your code to my category_item.php template override and did not work, so i made this change
Log in  or Create an account to join the conversation.

More
11 years 5 months ago #101164 by Ryo San
Hi,

I want to limit the words intro text for a multi categories menu.

I read the topic but I'm not a php developper.

I see this part of code in the category_item.php file :
<?php if($this->item->params->get('catItemIntroText')): ?>
	  <!-- Item introtext -->
	  <div class="catItemIntroText">
	  	<?php echo $this->item->introtext; ?>
	  </div>
	  <?php endif; ?>

First is it the right file to edit ?

Second how we should modify exactly the file to authorize words limit ?

Thanks a lot,

Ryo

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

More
10 years 3 months ago #101165 by Odin Mayland
Only because this topic was talking about word limit....

How can I limit the characters of the category title (span class catTitle) when using the Module: K2 Tools > Categories List (Menu) ?

And preferably add "..." at the end to denote it has been truncated.

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

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
10 years 3 months ago #101166 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Re: How to limit introtext on multi-category menu page
Hi,

To limit the characters of the category title, edit the mod_k2_tools/helper.php file

Find this line, it should be at line ~570:
if (modK2ToolsHelper::hasChildren($row->id))

Add this code at directly before the above line:
$catTitleLimit = 10;
if(strlen($row->name > $catTitleLimit)) $row->name = substr($row->name,0,$catTitleLimit).'...';

Then adjust the value of $catTitleLimit as you like, in the example it 10 charachters.

Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store

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