How to display line breaks?

Дата добавления:
18.08.2010
Последнее изменение:
21.02.2011
Хиты:
6339
Рейтинг:
 
Голосовать:
Хорошо - Плохо

Ответ

Task

I have a text field that has returns in it, however these are not displayed. Is there a way to correct this?

Solution

To display line breaks in your DW Anything module output, you'll need to replace the line break characters from your text field with HTML "<br/>" tags.

Example

You have a table "_text_table" and a field in it called "text".

To display the line breaks from this field, use the following SQL query:

SELECT REPLACE(`text`, CHAR(10), '<br/>') AS `text` FROM `_text_table`

Категория

Комментарии   

 
+1 # Doesn't workGuest 19.02.2011 11:28
This doesn't work. When you try to save the module, it strips the \n out of the query.
Ответить | Ответить с цитатой | Цитировать
 
 
0 # RE: Doesn't workAdministrator 21.02.2011 00:04
You're right. I've fixed the example.

Thanks for your report!
Ответить | Ответить с цитатой | Цитировать
 
 
0 # RE: How to display line breaks?Glenn 23.11.2012 09:49
Is it possible to pass parameters to the module?
Ответить | Ответить с цитатой | Цитировать
 
 
0 # RE: How to display line breaks?Administrator 23.11.2012 17:11 Ответить | Ответить с цитатой | Цитировать
 

Добавить комментарий


Защитный код
Обновить

SEO by Artio