2012-06-19, 09:39 PM
Replacing MyBB's [php ] with syntaxhighlighter
first you need to download the syntaxhighlighter
http://alexgorbatchev.com/SyntaxHighligh...sh_current
Then open it up and upload
You probably don't have the folder sh so make it.
Now for the replacing codes part.
1) Go to your admin CP
Templates & Style -> Templates -> Choose the template you use -> Show Thread Templates -> showthread
add
Then now go to your mybb/inc and look for class_parser.php
find
add /* before
add */ after
after the */ make a new line by pressing return and add
Now open up functions_post.php in the same folder
find
then add new line and add
You probably want to edit the .css file so it matches your theme.
first you need to download the syntaxhighlighter
http://alexgorbatchev.com/SyntaxHighligh...sh_current
Then open it up and upload
shCore.js
shBrushPhp.js
shCoreDefault.css
to mybb root/sh/You probably don't have the folder sh so make it.
Now for the replacing codes part.
1) Go to your admin CP
Templates & Style -> Templates -> Choose the template you use -> Show Thread Templates -> showthread
add
<script type="text/javascript" src="./sh/shCore.js"></script>
<script type="text/javascript" src="./sh/shBrushPhp.js"></script>
<link type="text/css" rel="stylesheet" href="./sh/shCoreDefault.css" />
<script type="text/javascript">SyntaxHighlighter.all();</script>
under {$headerinclude}Then now go to your mybb/inc and look for class_parser.php
find
function mycode_parse_php
add /* before
if($text_only == true)
add */ after
return "<div class=\"codeblock phpcodeblock\"><div class=\"title\">$lang->php_code\n</div><div class=\"body\">".$code."</div></div>\n";
after the */ make a new line by pressing return and add
return "<pre class=\"brush: php;title:PHP\">$str</pre>";
Now open up functions_post.php in the same folder
find
$post['message'] = $parser->parse_message($post['message'], $parser_options);
then add new line and add
$post['message'] = str_replace("<br />", "", $post['message']);
You probably want to edit the .css file so it matches your theme.