CodeIgniter Forums
textarea duplicates line breaks - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: textarea duplicates line breaks (/showthread.php?tid=38254)

Pages: 1 2

textarea duplicates line breaks - El Forum - 04-07-2011

CodeIgniter User Guide - Typography Helper
Not sure if this will solve your problems but give it a try.
Converts newlines to <br /> tags unless they appear within <pre> tags. This function is identical to the native PHP nl2br() function, except that it ignores <pre> tags.

Usage example:
$string = nl2br_except_pre($string);


textarea duplicates line breaks - El Forum - 04-10-2011

[eluser]Freeze Dried Pop[/eluser]
[quote author="mikkelz" date="1302174534"]I take it that updating the Input class in /system/core is a better option than creating a custom input class to override that bit of code?

Or what is the recommended method for resolving these bugs until a new version is released?


I kind of answered my own question by going ahead and modifying the Input class with the latest change on bitbucket.

Line #542:

$str = str_replace(array("\r\n", "\r", "\r\n\n"), PHP_EOL, $str);

It feels "cleaner" than hacking in a custom class for something small like this.

Edit 2:

Thanks for the link JuanitoDelCielo[/quote]
Cheers, i've implemented this and it's fixed now.

Was racking my brains for a good hour before realising it might be something to do with Code Igniter. That's the last time I douby my knowledge of simple HTML.