rmnl() in textareas

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
Post Reply
Gert
Posts: 3078
Joined: Fri May 30, 2008 4:53 pm
Location: Berlin
Contact:

rmnl() in textareas

Post by Gert » Mon Jul 18, 2011 10:19 pm

Hallo,

the function rmnl() removes empty lines, for example by reading stylesheet.css, template.htm etc. into textareas. That way, well structured files are not structured anymore after reading into textarea and saving.

Code: Select all

function rmnl($t) {
    return preg_replace("/(\r\n|\r|\n)+/", "\n", $t);
} 
Shouldn't we remove rmnl() in lines 233 and 285 of adm.php? So the structure of the files would be kept.
Gert Ebersbach | CMSimple | Templates - Plugins - Services

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: rmnl() in textareas

Post by cmb » Tue Jul 19, 2011 12:03 am

Hello Gert,
Gert wrote: Shouldn't we remove rmnl() in lines 233 and 285 of adm.php? So the structure of the files would be kept.
I've already wondered why the template and stylesheet looked so "compressed" in the back-end. You've found the reason. So

+ 1

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

bca
Posts: 293
Joined: Tue Sep 15, 2009 4:49 pm

Re: rmnl() in textareas

Post by bca » Tue Jul 19, 2011 1:48 pm

want to try this but when i do i get no content in the textarea.
can you be more precise about what to remove please?

b

Gert
Posts: 3078
Joined: Fri May 30, 2008 4:53 pm
Location: Berlin
Contact:

Re: rmnl() in textareas

Post by Gert » Tue Jul 19, 2011 1:57 pm

adm.php line 233:

Code: Select all

else $text = rmnl(stsl($text));  // old

else $text = stsl($text);  // new    
adm.php line 285:

Code: Select all

else $o .= '<textarea rows="25" cols="50" name="text" class="cmsimplecore_file_edit">'.rmnl(rf($pth['file'][$file])).'</textarea>';  // old

else $o .= '<textarea rows="25" cols="50" name="text" class="cmsimplecore_file_edit">'.rf($pth['file'][$file]).'</textarea>';  // new   
Gert Ebersbach | CMSimple | Templates - Plugins - Services

bca
Posts: 293
Joined: Tue Sep 15, 2009 4:49 pm

Re: rmnl() in textareas

Post by bca » Tue Jul 19, 2011 1:59 pm

thanks. i can see what i did wrong :oops:

Post Reply