Keyword

Enable HTML in K2 title fields

  • Matt
  • Matt's Avatar Topic Author
  • Offline
  • Senior Member
More
11 years 8 months ago #108717 by Matt
Enable HTML in K2 title fields was created by Matt
If you try to insert html tags in K2 title fields (the fields when you try to create a category or an item) the html will be stripped from the title after saving. Because of this, you can't style certain parts of the title.

How can I edit K2 that it doesn't strip html tags from title fields?

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

More
11 years 8 months ago #108718 by william white
Replied by william white on topic Re: Enable HTML in K2 title fields
im working on something similar
my idea is to do it in the override like this
in the override
explode the title string into array of words using " " qualifier
loop thru array
echo out styling around first word and not the rest to rebuild the string with formatting

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

  • Matt
  • Matt's Avatar Topic Author
  • Offline
  • Senior Member
More
11 years 8 months ago #108719 by Matt
Replied by Matt on topic Re: Enable HTML in K2 title fields
I think I get what you mean, but I don't know how to do it. It would be easier to just allow html tags in the title. Currently there is a function present that checks if there are html tags in titles and strippes them from the title when found. So if we can delete this function this problem should be resolved. The question is where is this function? Seeing that Joomla's com_content has this issue as well, K2 may have inherited it.

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

More
11 years 8 months ago #108720 by william white
Replied by william white on topic Re: Enable HTML in K2 title fields
There are also some settings about which tags get stripped i think, but haven't been there in a while.
I usually have quicker results with overrides and css4k2 as i can use the core of both joomla and k2 without delaying until new versions are released which may or may not be incorporated.
I read a post the other day from Akeeba support that said " he recommended a fix, but it was not incorporated into j core" therefore he is limited to what he can do.

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

  • Matt
  • Matt's Avatar Topic Author
  • Offline
  • Senior Member
More
11 years 8 months ago #108721 by Matt
Replied by Matt on topic Re: Enable HTML in K2 title fields
Somewhere in joomla's core files there should be a line that contains "strip" and then some unwanted characters. I'm sure I can figure it out if I find the correct file.
Sadly this here is for Joomla 1.0: forum.joomla.org/viewtopic.php?p=154925

I will keep you updated if I have succeeded.

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

More
11 years 8 months ago - 11 years 8 months ago #108722 by chilly_bang
Replied by chilly_bang on topic Re: Enable HTML in K2 title fields
It seems to me, like K2 would use for title cleaning Joomlas own stripping method, taken from library/joomla/filter/output.php.
Look into line 62 in administrator\components\com_k2\tables/k2item.php you will see
Log in  or Create an account to join the conversation.

More
10 years 10 months ago #108723 by RCC
Replied by RCC on topic Re: Enable HTML in K2 title fields
Hello,
I have the same issue, I want to enable HTML in K2 title.
I have tried to comment
$this->title = JString::trim($this->title);
but the HTML code into title has been also removed.
How can I fix this issue? Do you solve it?

Thanks in advance
Rosa

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