You don't want to save the post to the DB with the newlines as breaks? Then just convert it when you echo it in the view.
Also, you can use PHP's nl2br() function instead of str_replace(). On Fri, Jul 31, 2009 at 9:56 AM, in2lag<[email protected]> wrote: > > well, this is not the exactly same way, which i want... because in > your solution, i update data in db too... but thanks.... > > On 31 čnc, 14:11, Rick <[email protected]> wrote: >> You could put this in your controller (edit and add) just after you >> get the data back from the form or you can put the code in your model >> in a before_save method. >> >> Rick >> >> On Jul 31, 6:16 am, in2lag <[email protected]> wrote: >> >> >> >> > Hi, i have problem in my application with new lines in posts. CakePHP >> > probably replace "bad" characters from db results and i need to >> > str_replace('\n','<br />',$somePost['Post']['text']) to keep new lines >> > in posts, Can somebody help me with this problem? I tried to search >> > google and this group, but with no success... Thank you > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
