codebyren Posted February 26, 2010 Share Posted February 26, 2010 Hi, I am trying to print out html code so that a user can just copy and paste it from my site without having to dig into the page source. I know this can be done with htmlentities but I am having a problem preserving any indentation etc. to keep it neat. What do developers usually use for this? For example: <tr> <!-- See how this is indented... --> <td>data</td> <td>more data</td> </tr> I believe HTML Tidy will do this but the server in questions doesn't have it available so hoping there are alternative options that are also less of an overkill. If it makes any difference, I will probably be generating the HTML with output buffering or pulling the source of a remote file using get_file_contents. Thanks for any help! Link to comment https://forums.phpfreaks.com/topic/193424-displaying-code-in-html/ Share on other sites More sharing options...
teamatomic Posted February 26, 2010 Share Posted February 26, 2010 <pre></pre> HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/193424-displaying-code-in-html/#findComment-1018352 Share on other sites More sharing options...
codebyren Posted February 26, 2010 Author Share Posted February 26, 2010 lol, I'm going to take this as a sign that I have been doing back-end development for too long. And then I'm going to re-read HTML for dummies. Thanks for the wake-up call. Link to comment https://forums.phpfreaks.com/topic/193424-displaying-code-in-html/#findComment-1018359 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.