Keyword

Keep user line breaks in comments

  • Krista
  • Krista's Avatar Topic Author
  • Offline
  • New Member
More
14 years 8 months ago #71686 by Krista
Keep user line breaks in comments was created by Krista
When a user enters a comment, and breaks their text apart into multiple paragraphs, the line breaks are stripped when the comment is saved - is there any way to save these line breaks so that it displays how the user intended?

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

More
14 years 7 months ago #71687 by Travis Prebble
Replied by Travis Prebble on topic Keep user line breaks in comments
I would like to know this as well.

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

More
14 years 7 months ago #71688 by Travis Prebble
Replied by Travis Prebble on topic Keep user line breaks in comments
The line breaks are already saved - they show up when looking in the database.

What you need to do is change your components/com_k2/templates/default/item.php template to convert the line breaks to HTML breaks.

nl2brfunction.txt

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

  • Krista
  • Krista's Avatar Topic Author
  • Offline
  • New Member
More
14 years 7 months ago #71689 by Krista
Replied by Krista on topic Keep user line breaks in comments
This is great, thank you Travis!!

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

More
14 years 7 months ago #71690 by Piet Nutbey
Replied by Piet Nutbey on topic Keep user line breaks in comments
Thanks, this got it solved for me! Took a bit more, because I was using a RocketTheme template which uses template overrides for K2. At first I was wondering why the "trick" didn't work.

For those using RocketTheme templates, look in: /joomla_root/templates/your_RocketTheme_template/html/com_k2/templates/default/item.php

In the item.php file, put the code as shown in nl2brfunction.txt

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

More
14 years 3 months ago #71691 by suesbarn
Replied by suesbarn on topic Keep user line breaks in comments
Thanks.
is there any way to use this to add line breaks in the extra fields text?



Piet Nutbey said:Thanks, this got it solved for me! Took a bit more, because I was using a RocketTheme template which uses template overrides for K2. At first I was wondering why the "trick" didn't work.For those using RocketTheme templates, look in: /joomla_root/templates/your_RocketTheme_template/html/com_k2/templates/default/item.phpIn the item.php file, put the code as shown in nl2brfunction.txt

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

More
14 years 2 months ago #71692 by suesbarn
Replied by suesbarn on topic Keep user line breaks in comments
Yes! It also worked for line breaks in the extra fields. I used this:


in the item.php.
Thanks again.

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


Powered by Kunena Forum