Page 1 of 1
Multiline text in table cell (custom page)
Posted: 2021-04-16 06:33
by sacgtdev
I have one question on the multiline display:
The paragraph inserted into the text area showed quite well in the table cell in multiline format.
However, in the DB, it is actually preserved in string without line.
How to display it in multiline form in the custom page? I have been trying to add css for the custom page as follow, but it didn't work out:
###
.multiline {
white-space: pre-wrap;
}
<div class="multiline">
A multiline text
for demo purpose
</div>
Re: Multiline text in table cell (custom page)
Posted: 2021-04-16 11:00
by onoehring
Hi,
could you post some screenshots? And: How do you know how the string is saved in the database? If you displayed the DB contents in the browser there is already interference (as the browser takes some form of representation of that string).
Olaf
Re: Multiline text in table cell (custom page)
Posted: 2021-04-17 06:21
by sacgtdev
The representation of the content in table cell:
1) text-area
line 1
line 2
line 3
line 4
2) DB
line 1
line 2
line 3
line 4
3) Save CSV
line 1 line 2 line 3 line 4
4) In custom page
line 1 line 2 line 3 line 4
How to make the representation of text in multiline format as shown in (1) and (2) for (3) and (4)?
Regards,
Stephen
Re: Multiline text in table cell (custom page)
Posted: 2021-04-17 06:49
by onoehring
Hi Stephen,
just a try: Maybe take a look at the nl2br function of PHP and run the data through this before using it in a custom page. CSV ... let's do this once your custom page works. See:
https://www.php.net/manual/en/function.nl2br.php
https://www.w3schools.com/PHP/func_string_nl2br.asp
Olaf
Re: Multiline text in table cell (custom page)
Posted: 2021-04-18 03:52
by sacgtdev
Dear Olaf,
That will work only when the text have \n to indicate where to break the line.
However, the existing text do not have \n.
I wonder how the original table cell could show the representation of text with line-break.
Re: Multiline text in table cell (custom page)
Posted: 2021-04-18 06:59
by onoehring
Hi,
I would suggest looking at your data with MySQL Workbench or some other tool which does not include the browser. If there are linebreaks somewhere, they must obviously be saved with the data.
Olaf