allistera Posted April 24, 2008 Share Posted April 24, 2008 Hey there, I am using geshi to text highlight PHP code that is surronded with [ code] tags. Here is my current function: function highlightCode($source, $language) { $geshi =& new GeSHi($source, $language); echo $geshi->parse_code(); } function article_bbcode ($str) { $str = preg_replace('/\[code\=([a-z]+)\](.*?)\[\/code\]/ies', "highlightCode(\"$2\", \"$1\")", $str); return $str; } The code outputs fine and is colored fine, but the only problem is that all varables are removed and not outputed, example: When $var = 1;[ /code] goes throught this comes out: [code=php:0] = 1; Thanks for all help. Link to comment https://forums.phpfreaks.com/topic/102635-blog-code/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.