Thanks John! nl2br() works great!


On Nov 27, 11:52 am, "John David Anderson (_psychic_)"
<[EMAIL PROTECTED]> wrote:
> On Nov 27, 2006, at 9:34 AM, gabordemeter wrote:
>
>
>
>
>
> > Hi! I'll give an example to illustrate my problem:
>
> > I have a form which, among other fields, contains a textarea.
>
> > In the textarea area I write the following:
>
> > - abc
>
> > - cde
>
> > Basically I first write the string "- abc", then I hit [return] twice
> > and then write the string "- cde".
>
> > After I save my form, I go to phpMyAdmin and view the respective
> > record. It correctly shows "- abc" on the first row, then there's a
> > blank row (due to the two returns i inserted) and then, on the third
> > row it shows the string "- cde".
>
> > So far so good. And now the problem:
>
> > On another page, I want to display the above with <?php echo
> > $item['Comment']['text']; ?> .
>
> > It shows as:
>
> > - abc - cde
>
> > The two strings are only separated by a space, so obviously the two
> > returns do not show.
>
> > In PHP (before cake), I would solve this by doing:
>
> > echo <<<END
> > $item['Comments']['text']
> > END;This works? Did you try it in your view?
>
>
>
> > That would print both the strings and the returns. How can I achieve
> > the same result in cake? Thx!<?php echo nl2br($item['Comment']['text']); ?>
> 
> -- John


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Cake PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to