Re: nl2br problem

From: Date: Tue, 01 Feb 2011 20:24:35 +0000
Subject: Re: nl2br problem
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-311123@lists.php.net to get a copy of this message
Daniel Brown wrote: [snip]
     Absolutely.  Look into employing TinyMCE or CKEditor (or the older
FCKEditor) so you don't have to do so much server-side processing. This will only apply to pages moving forward, mind you, not for displaying existing table data. You'll need to make the determination if it's right for your specific case.
I probably should have went that route! I'm really bad about looking for existing solutions. ;-) Instead, I I am using a conditional where if the content contains a table, then don't use nl2br... then I told the admin that if they use tables in their body content, then they will have to include the <br />'s themselves. --- $t_tablecount = substr_count($t_body, '<table'); $t_endtablecount = substr_count($t_body, '</table'); if (($t_tablecount > 0) && ($t_endtablecount > 0)) { print "$t_body"; } else { print nl2br("$t_body"); } --- I guess that will work for now. Donovan -- D Brooke

« previous php.general (#311123) next »