phpcakephpcakephp-1.3

display line breaks( \r\n )


I'm really confused now. I am trying to display line breaks to a view by using echo nl2br($text).

I saved the text using the Sanitize::clean( $text, array('carriage'=>false) )

I viewed the text saved in the database and it is saved properly. I see linebreaks being translated to \r\n, ' to ’, etc..

what I might be doing wrong?


Solution

  • dont use Sanitize

    its totally unnecessary

    simply save it and display it afterwards with

    echo nl2br(h($text));