Stickybomb Posted January 27, 2007 Share Posted January 27, 2007 Hi i have been using php for several monsths now and I think it rocks.how ever i was wondering when your echoing html with php how you can get it to display it cleaner like tab and organized like it was coded that way. I tried using the /n new line but it just displays the text? ???can some on please help me with this thxs :) Quote Link to comment https://forums.phpfreaks.com/topic/35927-newbish-question/ Share on other sites More sharing options...
trq Posted January 27, 2007 Share Posted January 27, 2007 Example.[code]<?php echo "<html>\n"; echo " <head>\n"; echo " <title>foo</title>\n"; echo " <head>\n"; echo " <body>\n"; echo " <p>this is a paragraph</p>\n"; echo " </body>\n"; echo "</html>\n";?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/35927-newbish-question/#findComment-170387 Share on other sites More sharing options...
Jessica Posted January 27, 2007 Share Posted January 27, 2007 You need to use HTML. A new line in html is[code]<br />[/code] Quote Link to comment https://forums.phpfreaks.com/topic/35927-newbish-question/#findComment-170388 Share on other sites More sharing options...
Stickybomb Posted January 27, 2007 Author Share Posted January 27, 2007 no i know the whole /n new line code, sorry if I was unclear I was wondering if there was another way of doing the same sort of thing. the /n does not always work in every situation, and i tend to be very neat and picky when it comes to my code so I am looking for the most control over how it outputs it. Quote Link to comment https://forums.phpfreaks.com/topic/35927-newbish-question/#findComment-170395 Share on other sites More sharing options...
trq Posted January 27, 2007 Share Posted January 27, 2007 The \n not /n does work when within double quotes. I'm a little lost as to what your question really is. Are you asking how to make newlines in html source or in html output? A new line in html is <br /> as jesirose pointed out. Otherwise, you'll need to explain your question better. Quote Link to comment https://forums.phpfreaks.com/topic/35927-newbish-question/#findComment-170396 Share on other sites More sharing options...
.josh Posted January 27, 2007 Share Posted January 27, 2007 I think what he means is when you are looking at the webpage through the browser, and you right-click > view source, the html source code is all tidy and indented, etc.. instead of all just one line or something. As in, when you dynamically create html with php, how to include the "tidiness." Quote Link to comment https://forums.phpfreaks.com/topic/35927-newbish-question/#findComment-170399 Share on other sites More sharing options...
Braclayrab Posted January 27, 2007 Share Posted January 27, 2007 <?php?><html> <head> <title>foo</title> <head> <body> <p>this is a paragraph</p> </body></html> ;D Quote Link to comment https://forums.phpfreaks.com/topic/35927-newbish-question/#findComment-170417 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.