Extension

Developer
Supported

GWcode SyntaxHighlighter

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Leon Dijk

     

You must be logged in to post.

Unable to load brush: php

Support (Resolved)

Ryan Masuga
Ryan Masuga

Leon -

I have this installed correctly in that the new button shows in Wygwam and adding code snippets works fine there. On the front-end though, no matter what paths I use to link to the SyntaxHighlighter scripts and styles, I get a browser alert/error when a page loads that is supposed to have syntax highlighting on it:

SyntaxHighlighter

Can’t find brush for: php

I have the following code at the bottom of my page:

<script type="text/javascript" src="/assets/tools/sh2/scripts/shCore.js"></script>
<script type="text/javascript" src="/assets/tools/sh2/scripts/shBrushEE.js"></script>
<link type="text/css" rel="stylesheet" href="/assets/tools/sh2/styles/shCore.css" />
<
link type="text/css" rel="stylesheet" href="/assets/tools/sh2/styles/shThemeDefault.css" />
<
link type="text/css" rel="stylesheet" href="/assets/tools/sh2/styles/shEE.css" />
<
script type="text/javascript">
SyntaxHighlighter.all();
</script> 

I’ve confirmed that all paths are correct. The only “unusual” thing about my setup is that the system folder is above web root.

Anything else I should look for?

Leon Dijk (GWcode)
# 1
Developer
Leon Dijk (GWcode)

Hey Ryan,

If you get that error, it means the “brush” (javascript file) for php syntax highlighting isn’t being included on the page, even though (it seems) you’re trying to get syntax highlighting for php code.

For each language you need syntax highlighting for, you need to include the corresponding javascript brush. So if you selected PHP as the language in the Wygwam popup, you need to include the PHP brush.

Let me know if that solves it!
Personally, I have just merged the brushes for a couple of languages (bash, php, EE) into one file that I’m including in my pages, saves a couple of HTTP requests.

Ryan Masuga
# 2
Ryan Masuga

Ah, I see. That did it. My error. Thanks for clearing that up, Leon.

Leon Dijk (GWcode)
# 3
Developer
Leon Dijk (GWcode)

No problem, glad that fixed it.
If you also intend to use this for EE code and you notice something not being highlighted properly, let me know, I’m using a different version of the EE brush on my own site which has some modifications for EE tag parameters etc.

Cheers,
Leon