Hi everyone
I have a TV with input type textarea and output type standard. I would like to use this text area for filling in an adress. For example:
Company Name
Adress
ZIP/City
This works fine, until the content of the TV is displayed in my template. The Problem is, that there are no longer line breaks and it shows like this (everything in one line):
Company Name Adress ZIP/City
Is there a easy way, that the line breaks will be stored with the content of the TV?
Thank you
Modx 2.1.3, PHP 5.2
-
☆ A M B ☆
- 24,524 Posts
Line breaks aren’t recognized by HTML, you have to use some mechanism for converting the line breaks into
tags; or enclose the whole thing in <pre>...</pre> tags, which will recognize line breaks. You could do that using the "HTML generic tag" widget, specifying pre as the tag name. Or make up your own custom output formatting snippet and use the PHP nl2br() function. You might also be able to do something with a PHx modifier.
http://wiki.modxcms.com/index.php/Adding_TV_Widgets_without_hacking_the_core
http://www.php.net/manual/en/function.nl2br.php
http://wiki.modxcms.com/index.php/PHx#nl2br
-
☆ A M B ☆
- 24,524 Posts
I’m not sure about Revo, but in Evo you can’t use tags like that in the PHP code, you have to use one of the API functions to fetch the TV value.