ecabrera Posted April 3, 2012 Share Posted April 3, 2012 What do website use to be able to show there php code with out running it for example some website you can go and copy the code inside the box and it does run Quote Link to comment https://forums.phpfreaks.com/topic/260226-php-code/ Share on other sites More sharing options...
dragon_sa Posted April 3, 2012 Share Posted April 3, 2012 show_source(/path/to/file); Quote Link to comment https://forums.phpfreaks.com/topic/260226-php-code/#findComment-1333799 Share on other sites More sharing options...
ecabrera Posted April 3, 2012 Author Share Posted April 3, 2012 thanks Quote Link to comment https://forums.phpfreaks.com/topic/260226-php-code/#findComment-1333801 Share on other sites More sharing options...
rythemton Posted April 3, 2012 Share Posted April 3, 2012 I put this in one of my scripts that I was going to make open source: <?php $output = strtoupper( trim( isset($_REQUEST['source']) ? $_REQUEST['source'] : "false" ) ); if ( $output == "TRUE" ) { header('Content-type: text/plain'); echo ( file_get_contents( "cool.php" ) ); } else { ?> <html> <head>... The show_source() function is supposed to do syntax highlighting. I guess it depends on what you are doing. Quote Link to comment https://forums.phpfreaks.com/topic/260226-php-code/#findComment-1333811 Share on other sites More sharing options...
jcbones Posted April 3, 2012 Share Posted April 3, 2012 You guys had me going. I always used highlight_file, but I see that show_source is an alias of it. PS. if you only want to highlight a section of code or a "string", use highlight_string. Quote Link to comment https://forums.phpfreaks.com/topic/260226-php-code/#findComment-1333813 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.