Kostache: \n or enter key does not go to next line

114 Views Asked by At

I am using Kostache, Kohana and CKEditor for my website. In the database some of the tables are readonly, the content is coming from some other site. My issue is that, I need to show a new line wherever enter is given in the content. In current situation, all content comes in one line without any break

example: Input/Expected Output: "This is the text.

This is the new Text."

Current Output: "This is the text. This is the new Text."

Is there any solution for this..

1

There are 1 best solutions below

0
On

If you are storing the new line character in the database, on the frontend side of things, you can use nl2br() to convert the new lines to break tags. Then with Kostache, you have to tell it to allow html in the variable (i.e. {{& content_var}}).

If you have no new line characters stored with the character, you could create a much uglier solution, like using replacing period with a period and break tag, although I do not recommend that solution unless you absolutely have no other option.