Keyword

Item View in Category - Limit Intro text by Character Limit

  • Tracey
  • Tracey's Avatar Topic Author
  • Offline
  • Senior Member
More
9 years 7 months ago #140603 by Tracey
Hi,

Forgive me if this has been discussed before but i would like to limit my intro text in the item category view. I know I can limit intro text by word count however I would like to limit by character count.

As you know k2 can also strip html tags from the intro text which is good. I am however having a problem with this when it comes to the
<br>
tag. Is there a way to replace that tag with a space in the intro text?

Does anyone have a code snippet I can use that will limit the category item intro text by character count and replace the
<br>
tag with
&nbsp;
.

I assume I will need to replace a block of code in the html override file category_item.php. If anyone knows how to accomplish the above, could you show the code that needs to be replaced and the replacement code.

I understand this will most likely cause the "Introtext word limit" in "Item view options in category listings" to stop working but thats ok.

Thanks

Joomla! v3.5.1
Gantry5 - Hydrogen Template
k2 v2.7.0

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 7 months ago #140642 by Krikor Boghossian
Replied by Krikor Boghossian on topic Item View in Category - Limit Intro text by Character Limit
Hello, the word/character limit will strip all tags.
This is nothing that can be changed. You way try to replace all the <br/> tags prior to applying a limit with PHP's str_replace php.net/manual/en/function.str-replace.php

You can find an example here: www.joomlaworks.net/forum/k2-en/17656-parameter-for-maximum-caracter-in-the-title#62142

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

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


Powered by Kunena Forum