I am trying to integrate this SyntaxHighlighter to my website. I included all files exactly how in the example, but it does not work.
When I take a look at the web concole it says
ReferenceError: SyntaxHighlighter is not defined @ shBrushPhp.js:81
shBrushPhp.js is part of the files i had to include and I wounder why it does not work. Any ideas?
It would also help if you could say me where SyntaxHighlighter is normally defined.
The line where the error occurrs:
Brush.prototype = new SyntaxHighlighter.Highlighter();
I am trying to integrate this SyntaxHighlighter to my website. I included all files exactly how in the example, but it does not work.
When I take a look at the web concole it says
ReferenceError: SyntaxHighlighter is not defined @ shBrushPhp.js:81
shBrushPhp.js is part of the files i had to include and I wounder why it does not work. Any ideas?
It would also help if you could say me where SyntaxHighlighter is normally defined.
The line where the error occurrs:
Brush.prototype = new SyntaxHighlighter.Highlighter();
Share
Improve this question
edited May 5, 2013 at 16:46
asked May 5, 2013 at 16:40
user2235728user2235728
5
- 2 Post the code here too – Ejaz Commented May 5, 2013 at 16:42
- R u include syntaxhighter js above the shBrushPHP.js – Tamil Selvan C Commented May 5, 2013 at 16:46
- Yes I do, all files are correctly included. – user2235728 Commented May 5, 2013 at 16:46
- Can you provide a link to the page that this is happening on? Clearly things are not 'correctly' included, since it's not working; being able to see the page in question will let us help you figure out the problem here. – Dancrumb Commented May 5, 2013 at 16:49
- 1 @Dancrumb He should include code here to make this question a useful one meta.stackexchange./questions/125997/… – Ejaz Commented May 5, 2013 at 16:50
1 Answer
Reset to default 4It's a pity, that the interrogator didnt follow the answers to his questions. So the question is still open and we have wether a link nor a code snippet.
At least i had the same error ("SyntaxHighlighter is not defined") and i solved it with bringing my script-tags into the correct order. So make sure you import both javascript files (shCore.js and shBrushJScript.js) in the right order:
<script type="text/javascript" src="js/shCore.js"></script>
<script type="text/javascript" src="css/shBrushJScript.js"></script>
You can see that in the SyntaxHighlighter website you have linked to.
The SyntaxHighlighter object is initialized when running through the shBrushJScript.js. So at this point the SyntaxHightlighter - defined in shCore.js - have to be known. If the SyntagHighlighter is announced later in the code, shBrushJScript does not know it.