imarockstar Posted October 12, 2009 Share Posted October 12, 2009 I am outputting some pho code .. and I want to display the source code so people can copy and paste it .... not really wanting to use a TEXTAREA box .... any ideas ? Quote Link to comment https://forums.phpfreaks.com/topic/177462-how-can-i-display-php-source-code-snippets/ Share on other sites More sharing options...
mikesta707 Posted October 12, 2009 Share Posted October 12, 2009 use html entities Quote Link to comment https://forums.phpfreaks.com/topic/177462-how-can-i-display-php-source-code-snippets/#findComment-935704 Share on other sites More sharing options...
PFMaBiSmAd Posted October 12, 2009 Share Posted October 12, 2009 Or php's highlight_ functions - <?php $file = 'help.php'; // name of file containing php code $content = highlight_file($file,true); // get and highlight the php code ?> <style type="text/css"> .code { border-style:solid; border-color:red; } </style> <?php echo '<div class="code">' . $content . '</div>'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/177462-how-can-i-display-php-source-code-snippets/#findComment-935712 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.