Question

I'm getting the following error message in Chrome and firefox while trying to implement gorbachev's syntax highlighter.

The page at local host says: SyntaxHighlighter Can"t find brush for: php

It's all the more frustrating because i just got it working on a test page in the same folder, it still works. There is very little different between the two pages. Here's my code:

<??>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"> 

<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 

<!--STYLESHEET LINKS-->
<link  href="stylesheet.css" rel="stylesheet" type="text/css" media="screen" />
<link  href="shThemeDefault.css" rel="stylesheet" type="text/css" media="screen" />
<link  href="shCore.css" rel="stylesheet" type="text/css" media="screen" />

<!--JQUERY SCRIPTS-->
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery-ui.js"></script>

<!--PROCESSING SCRIPTS
<script type="text/javascript" src="processing.js"></script>
<script type="text/javascript" src="init.js"></script>
-->
<!--syntax highlighter-->
<script type="text/javascript" src="shBrushPhp.js"></script>
<script type="text/javascript" src="shCore.js"></script>

<script type="text/javascript">
$(document).ready(function() {
   // put all your jQuery goodness in here.
   SyntaxHighlighter.all();
 });
</script>
</head>


<title>code</title>

<body>
<div id="content">
<h2>code</h2>
<pre class="brush: php">
$last_modified = filemtime("header.php");
echo("last modified: ");
echo(date("m.j.y h:ia", $last_modified));
</pre>

<!--<script type="application/processing">
</script>
<canvas data-processing-sources="processing/lines.pde">
</canvas> -->
</div>
</body>
</html>
<??>
Was it helpful?

Solution 3

i just moved all the content from the page into the test page, renamed it and it works fine now. just one of those things i guess.

OTHER TIPS

For me, the solution was making the brush style non-capital. So for me, I was adding a new brush to syntaxhighlighter (haskell), and I changed the markup:

<pre class="brush:Haskell">...</pre>

To

<pre class="brush:haskell">...</pre>

Alternatively, you could change the brush identifier:

Brush.aliases   = ['Haskell'];

Hope this helps!

It cant find the js file for the php highlighter. Make sure you uploaded the right brush and have the correct path for the brush. I had a lot of trouble getting it work in an MVC 3 application. I ended up using the S3 hosted files that Alex has. Trying calling the remoted files and see if it works. Also take the call SyntaxHighlighter.all() out of your jquery call. Mine is in its own set of script tags. See if that works.

  <link href="http://alexgorbatchev.com/pub/sh/current/styles/shCore.css" rel="stylesheet" type="text/css" />
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shAutoloader.js" type="text/javascript"></script> 
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushVb.js" type="text/javascript"></script> 
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js" type="text/javascript"></script>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top