PHP Development Framework Yii Framework Tutorial (a) UI component Texthighlighter sample

Source: Internet
Author: User
Tags config php code yii

Ctexthighlighter is used to format the display code, currently supports display of ABAP, CPP, CSS, DIFF, DTD, HTML, JAVA, JAVASCRIPT, MYSQL, PERL, PHP, PYTHON, RUBY, SQL , XML, the line number can also be displayed when the code is displayed, and the line number is displayed by Showlinenumbers=true.

This example shows the PHP code, one with line numbers, and one without line numbers:

PHP code <!--? php $this--->beginwidget (' ctexthighlighter ', Array (' Language ' => ' php '));?>//Include Yii Bootstrap file//require_once (dirname (__file__). ' /.. /..     
/framework/yii.php ');     
$yii = ' c:/yiiframework/yii.php ';     

Remove the following line production mode defined (' Yii_debug ') or define (' Yii_debug ', true); $config =dirname (__file__). '     

/protected/config/main.php ';     

Remove the following line when in production mode//defined (' Yii_debug ') or define (' Yii_debug ', true);     
Require_once ($YII);     
Yii::createwebapplication ($config)->run (); <!--? php $this--->endwidget ();?> PHP code with line number <!--? php $this--->beginwidget (' Ctex Thighlighter ', Array (' Language ' => ' PHP ', ' showlinenumbers ' => ' true ');?>/** * sitecontroller is th    
 e default controller to handle user requests. * * Class Sitecontroller extends Ccontroller {/** * Index ActIon is the default action in a controller.     

        * * Public Function Actionindex () {$model =new datamodel ();     

            if (!emptyempty ($_post[datamodel])) {$model->attributes=$_post[datamodel];     
         
        if ($model->validate ()) $success =true;     
         
                $this->render (' index ', array (' model ' => $model,     
    )); } <!--? php $this--->endwidget ();?>

Specify the kind of code you want to display by specifying the type of language (case-insensitive).

This example downloads: Http://www.imobilebbs.com/download/yii/TextHighlighterDemo.zip

See a full set of tutorials: http://www.bianceng.cn/webkf/PHP/201301/35265.htm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.