DaDaBIK
This forum is devoted to the discussion about the software DaDaBIK database front-end
the PHP Database application generator for MySQL, PostgreSQL and SQLite; also available for Wordpress.

Welcome! Log In Create A New Profile

Advanced

White space not respected in Details view

Posted by anders 
White space not respected in Details view
February 16, 2011 07:48AM
Hi there,

the format of a text that is inserted/edited with various (i. e. , more that one) white space characters between the words changes in the Details view. All the white space characters between different words except one are stripped out. However, in the Mysql database the white space characters are preserved correctly.

How to make the Details view reflect exactly how the text was entered?

Anders
Re: White space not respected in Details view
February 16, 2011 02:44PM
You can go to function get_field_correct_displaying and set those fields to display as preformatted text (put <pre></pre> around the field value part).

This is standard HTML behaviour - multiple spaces are displayed as one via HTML.

_______________________________
..:: Debbie |\.-./| DaDaBIK Support ::..
Re: White space not respected in Details view
February 17, 2011 06:07AM
Hi Debbie,

thanks for your answer. Following your advise I´ve managed to get the Details view to respect the multiple white space between words. However, now an empty line is inserted between each line in the text. How can this be avoided?

Best regards,

Anders
Re: White space not respected in Details view
February 17, 2011 09:36AM
Post a sample of the exact code from one of these fields. Unless I know what it is being saved as, I don't know how to help.
Thanks!

_______________________________
..:: Debbie |\.-./| DaDaBIK Support ::..
Re: White space not respected in Details view
February 17, 2011 10:20AM
An example of what I am trying to enter is as follows (please note that the underscores "symbolizes" the white space, since multiple white space between words will disappear also in this message!)

aaa_____bbbbbb_________ccccc______dddd
eeeee_____ffff__________ggggg______hhh
iii_______jjjj_____________________kkkkkkk

Without adding the pre tags this is displayed in the Details view as follows:

aaa bbbbbb ccccc dddd
eeeee ffff ggggg hhh
iii jjjj kkkkkkk

With pre tags added it looks like this:

aaa_____bbbbbb_________ccccc______dddd

eeeee_____ffff__________ggggg______hhh

iii_______jjjj___________________kkkkkkk


I. e the pre tags solve the problem with the white space between the words but it adds an additional new, empty line between the lines. Please note that the text always appears correctly in the Edit view!

What I have changed in business_logic.php is line 2818 to the following:

$displayed_part = "<pre>".$field_value."</pre>";

Also, the field in question is defined as a textarea and the content type as alphanumeric.

Best regards,

Anders
Re: White space not respected in Details view
February 17, 2011 10:34AM
Try this:

$displayed_part = "<pre>".preg_replace("/[\r\n]{2,}/i", "<br />", $field_value)."</pre>";

It looks as though the entry is getting a \r\n or combination of, so you need to replace those for display. The regex above should replace any combination occuring 2 or more times in the text.

_______________________________
..:: Debbie |\.-./| DaDaBIK Support ::..
Re: White space not respected in Details view
February 18, 2011 05:12AM
Hi Debbie,

it works like a charm! Thanks!!

Best regards,

Anders
Re: White space not respected in Details view
February 18, 2011 01:57PM
No problemo ... glad to help!

_______________________________
..:: Debbie |\.-./| DaDaBIK Support ::..
Sorry, only registered users may post in this forum.

Click here to login