jchili Client-side syntax highlighting for source code listings

  1. Requirements
  2. Usage
  3. Change log
  4. Resources

This widget encapsulates the Chili-jQuery plugin (modified version 2.2 for jQuery 1.4.2) and can be used to decorate code listings in most of popular computer languages (C++, C#, CSS, Delphi, Java, JavaScript, LotusScript, MySQL, PHP, and XHTML).

Requirements

Yii 1.1.6 or above...

Usage

  • install and explore the demo application
  • or extract the widget file under .../protected/extensions
  • put in a view a code blocks like the following...
Sample : HTML code
<?php
$html = <<<CODE
<html>
  <head>
    <title>Code Sample</title>
  </head>
  <body>
    <b>Hello World!</b>
  </body>
</html>
CODE;
$this->widget('ext.jchili.JChiliHighlighter',array(
    'lang'=>"html",
    'code'=>$html,
    'showLineNumbers'=>false
));
?>
Sample : PHP code loaded from a file:
<?php
$this->widget('ext.jchili.JChiliHighlighter',array(
    'fileName'=>__FILE__,
));
?>
Sample : Highlight a Yii class file:
<?php
$this->widget('ext.jchili.JChiliHighlighter',array(
    'pathAlias'=>"system.base",
    'fileName'=>"CComponent.php",
    'firstLineNumber'=>1,
));
?>
Sample : Highlight HTML5 content from a website
<?php
$this->widget('ext.jchili.JChiliHighlighter',array(
    'lang'=>"html",
    'fileName'=>"http://www.99lime.com/elements/",
    'firstLineNumber'=>1,
));
?>

Change log

Version 1.0
  • initial release
Version 1.4
  • code cleaning
  • bug fix
  • changed CSS

Resources

JQuery Plugin
Alternate Yii extensions
3 0
2 followers
966 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: User Interface
Developed by: volkmar
Created on: Mar 27, 2011
Last updated: 5 years ago

Downloads

show all

Related Extensions