- Posts: 111
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- [SOLVED] How to limit introtext on multi-category menu page
[SOLVED] How to limit introtext on multi-category menu page
- Sean Carney
-
Topic Author
- Offline
- Premium Member
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
-
Topic Author
- Offline
- Premium Member
- Posts: 111
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Moderator
- Posts: 8743
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
-
Topic Author
- Offline
- Premium Member
- Posts: 111
Sean
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Moderator
- Posts: 8743
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.
- william white
-
- Offline
- Platinum Member
- Posts: 3722
Please Log in or Create an account to join the conversation.
- Spyros Petrakis
-
- Offline
- New Member
- Posts: 2
Log in or Create an account to join the conversation.
- Ryo San
-
- Offline
- New Member
- Posts: 19
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.
- Odin Mayland
-
- Offline
- Platinum Member
- Posts: 404
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
-
- Offline
- Platinum Member
- Joomla Developer
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.
- Odin Mayland
-
- Offline
- Platinum Member
- Posts: 404
Thanks for this!
I would prefer to use an override but am not sure the path. Does this look right?
/templates/TEMPLATENAME/html/mod_k2_tools/helper.php
AND
This code works for some but not all the catTitle.
example of site under construction
Attachment not found
Please Log in or Create an account to join the conversation.
- Mohamed Abdelaziz
-
- Offline
- Platinum Member
- Joomla Developer
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.
- Odin Mayland
-
- Offline
- Platinum Member
- Posts: 404
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
PS. you can do the same with CSS as well.
text-overflow: ellipsis will do the trick.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Odin Mayland
-
- Offline
- Platinum Member
- Posts: 404
Please Log in or Create an account to join the conversation.
- Forum
- K2 Community Forum
- English K2 Community
- [SOLVED] How to limit introtext on multi-category menu page