简体   繁体   中英

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

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..

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 (ie {{& 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM