yii-prettify Syntax highlighting tool of source code snippets

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

This widget enable syntax highlighting of code snippets in your web application using Google Code Prettify.


Yii 1.1.6 or above...(tested with 1.1.10)


  • install and explore the demo application
  • or extract the widget file under .../protected/extensions
  • put in a view a code block like the following...
Sample : HTML code
<?php $this->beginWidget('ext.prettify.JPrettify');?>
<!DOCTYPE html>
    <meta charset="UTF-8">
    <title>Code Sample</title>
    <b>Hello World!</b>
<?php $this->endWidget();?>
Sample : PHP code from file
    'htmlOptions'=>array('style'=>'max-height: 340px; overflow-y: scroll;')
Sample : HTML5 code from any website
    'htmlOptions'=>array('style'=>'max-height: 600px; overflow-y: scroll;'))

Change log

Version 1.0
  • initial release
Version 1.1
  • code cleaning
  • bug fix
  • better support for highlighting of PHP5 keywords


Google Code Prettify
Alternate Yii extension
3 0
1 105 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: User Interface
Developed by: volkmar
Created on: Jun 17, 2012
Last updated: 9 years ago


show all

Related Extensions