Forum Moderators: coopster

Message Too Old, No Replies

New Lines without \n

         

Tom_Cash

12:43 am on Oct 28, 2008 (gmt 0)

10+ Year Member



Hi there,

I'm relativly new to using PHP at the level I am currently at. I am having an issue with how my HTML looks when generated by PHP. I am bringing back results from a database and lopping them intp HTML divs and in my view source I litterly have one big line oh HTML.

To break to a new line I have had to add \n to the end of each of my echo commands. Is there a way around this?

I tried print, rather than echo to no avail. I've wrote around 2000 lines of code for a site and ONLY just realised!

Please, someone, help!

Kindest regards,
Tom.

[edited by: Tom_Cash at 12:47 am (utc) on Oct. 28, 2008]

cameraman

12:53 am on Oct 28, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No other way that I know of.

dreamcatcher

8:01 am on Oct 28, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try echoing your HTML between single quotes and displaying it on multi lines

echo '<table>
<tr>
<td></td>
</tr>
</table>
';

If you mean, how do you convert current code automatically? As cameraman said, there are no instant fixes.

dc

Tom_Cash

10:20 am on Oct 28, 2008 (gmt 0)

10+ Year Member



Yeah, I was basically wondering if there was an alternative to echo or print that automatically rendered HTML on new lines. Looks like it's \n! Thanks for the replies!