Reputation: 3321
How do you print a new line break in CakePHP. I have tried this out:
echo "<b>\nhelloworld\n</b>";
instead of printing the it into three separate lines like this way:
<br>
helloworld
</b>
it just printed in this way when I viewed the HTML source code:
<b>helloworld</b>
Upvotes: 0
Views: 4494
Reputation: 2580
Your original line of code worked fine for me. I see that Anax solved your problem, above, but I wonder why carriage returns should be necessary but only in some circumstances?
Upvotes: 1
Reputation: 546075
that indeed is exactly how you add line breaks. What are you using to view the source code? Some tools, such as Firebug, normalise and reformat the source code for you which is why you might not be seeing the breaks.
Upvotes: 1
Reputation: 567
You could initially try just pressing enter and see if it's picked up...
If that doesn't work
Try doing it like this.
echo "<b>"."\n"."helloworld"."\n"."</b>";
Upvotes: 1