Monday, May 28, 2012

Syntax Highlighting

I've added Syntax Highlighting to my template:
  1. $document = &JFactory::getDocument();
  2. $document->addScript( '../media/system/js/jquery-1.7.1.js' );
  3. $document->addScript( '../media/system/js/jquery-ui-1.8.17.custom.min.js' );
  4. $document->addCustomTag( '<script type="text/javascript">jQuery.noConflict();</script>' );
To do this follow the instructions on the site but with one gotcha. When you add the javascript to the template, enclose the JS in a CDATA block:
  1. <script type='text/javascript'>
  2. //<![CDATA[
  3. PASTE THE JAVASCRIPT CODE HERE
  4. //]]>
  5. </script>

No comments: