niche Posted August 27, 2010 Share Posted August 27, 2010 I have a page that's generated by a php script. What's the easiest way to format the extremely long line of html that's in page source so it's easier to read? I'd like to avoid having to avoid manually format the page source so I can read it more easily or am i stuck having to format the page source manually. Link to comment Share on other sites More sharing options...
jeffman Posted August 27, 2010 Share Posted August 27, 2010 The simplest thing is to add newline characters: "\n" They can be embedded in loops at appropriate places, for instance.You can try to add tab characters ("\t") but that gets to be a hassle after a while. Link to comment Share on other sites More sharing options...
niche Posted August 27, 2010 Author Share Posted August 27, 2010 Thanks for the tip. w3 says /n is js. how do would I insert it in a line like this: echo '<a class="three" href="'.$row['locpage'].'">'.$row['locname'].' '.$offer.'</a>'; Link to comment Share on other sites More sharing options...
dsonesuk Posted August 27, 2010 Share Posted August 27, 2010 echo '<a class="three" href="'.$row['locpage'].'">'.$row['locname'].' '.$offer.'</a>'."\n"; Link to comment Share on other sites More sharing options...
niche Posted August 27, 2010 Author Share Posted August 27, 2010 Neat. Now I'm cookin with gas. Thanks to Deirdre's Dad and dsonesuk. Link to comment Share on other sites More sharing options...
jeffman Posted August 28, 2010 Share Posted August 28, 2010 FWIW, \n is pretty universal in languages derived from C, including JS and PHP. For it to be correctly interpolated in PHP, remember that it must be wrapped in double quotations (which I'm sure you're doing, since it works). Languages derived from Godforsaken BASIC have other ideas. No flames, please. Link to comment Share on other sites More sharing options...
niche Posted August 28, 2010 Author Share Posted August 28, 2010 That was a greatly appreciated addition to my vocab. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.