Keyword

K2 comments not saving line breaks

  • Travis Prebble
  • Travis Prebble's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 7 months ago #73724 by Travis Prebble
K2 comments not saving line breaks was created by Travis Prebble
My users tend to write in paragraphs, as do I, and the K2 comments are proving distracting since they strip out line breaks.

I would like to see if this can be fixed before the next release. Does anyone know where I might start looking in the code to solve this?

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

More
14 years 7 months ago #73725 by Lefteris
Replied by Lefteris on topic K2 comments not saving line breaks
Hi. This cannot be accepted as a bug as this is how it was designed to work. So it is a feature request for a next release. We will take this under serious consideration. The file that saves the comment is components/com_k2/models/item.php, function comment. Thanks.

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

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

  • Travis Prebble
  • Travis Prebble's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 7 months ago #73726 by Travis Prebble
Replied by Travis Prebble on topic K2 comments not saving line breaks
Thanks for adding it as a request.

I noticed that the line breaks are stored in the database, so I'm hoping I can just use nl2br function to replace the returns with HTML breaks upon render.

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

  • Travis Prebble
  • Travis Prebble's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 7 months ago #73727 by Travis Prebble
Replied by Travis Prebble on topic K2 comments not saving line breaks
Fixed! Just changed components/com_k2/templates/default/item.php to set up a new $brkinsert string and set it equal to nl2br($comment->commentText). Then, echo $brkinsert.

Works great, and I now have paragraphs in my comments!

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

More
14 years 3 months ago #73728 by suesbarn
Replied by suesbarn on topic K2 comments not saving line breaks
Hi,

Could you be more specific with this for those of us who are new to programming. Where and exactly what should we write? I am also interested in adding line breaks to the extra fields text areas. Will this work for that?

thanks.

Travis Prebble said:Fixed! Just changed components/com_k2/templates/default/item.php to set up a new $brkinsert string and set it equal to nl2br($comment->commentText). Then, echo $brkinsert.Works great, and I now have paragraphs in my comments!

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


Powered by Kunena Forum