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. Quote Link to comment https://forums.phpfreaks.com/topic/102635-blog-code/ 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.