Jump to content

Code Display Help


jjb123

Recommended Posts

Hi everyone, first of I just want to say I am new here so please forgive my lack of advanced php skill.

I am trying to run a tutorial website that requires a [code ] like function, I have tried everything I can thing of but nothing works, ether the quotes get messed up or the code does. I was just wondering if someone can point me in the direction of a tutorial to make a php and code display parser like the one on php freaks, that lets php and other code be displayed without being parsed.

 

Thank you.

Link to comment
https://forums.phpfreaks.com/topic/51915-code-display-help/
Share on other sites

Ok, I got it. I used:

 

function fetchCode( $code ){
//config
$prefix = "<center><div class=\"codehead\">Code:</div><div class=\"code\">"; //HTML code to add before your code, to add a markup
$suffix = "</div></center>"; //HTML code to close prefix
$return = stripslashes($code);
$return = highlight_string($return, true);
$return = $prefix . $return . $suffix;
return $return;
} 

Link to comment
https://forums.phpfreaks.com/topic/51915-code-display-help/#findComment-255978
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.