Introduction: This is a detailed page for yii tinymce syntax highlighting. It introduces PHP, related knowledge, skills, experience, and some PHP source code.
Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 332632 'rolling = 'no'>
First, download yii tinymce.
Extension, put it in your extensions directory,
Step 2 downloadSyntaxhighlighter, decompress the package and put the necessary files in your JS and CSS directories,
Shcore. JS, shcore.css, shthemedefault.css
These three are necessary files, plus the language you need to highlight. If it is Php, add shbrushphp. JS and Java are added to shbrushjava. JS. For more information, see the official documentation.
You can register directly in your controller action, for example:
$clientScript = Yii::app() -> clientScript;$clientScript -> registerScriptFile("/js/syntaxhighlighter/shCore.js");$clientScript -> registerScriptFile("/js/syntaxhighlighter/shBrushJava.js");$clientScript -> registerScriptFile("/js/syntaxhighlighter/shBrushJScript.js");$clientScript -> registerScriptFile("/js/syntaxhighlighter/shBrushPhp.js");$clientScript -> registerCssFile("/css/syntaxhighlighter/shCore.css");$clientScript -> registerCssFile("/css/syntaxhighlighter/shThemeDefault.css");
Step 3 downloadInstall syntaxhighlighter of tinymce
Address: http://github.com/RichGuk/syntaxhl
Download and decompress the package.Protected \ extensions \ tinymce \ assets \ tiny_mce \ plugins
Directory
Add the following parameters to your form page and display them in bold.
'plugins'=>'syntaxhl', 'theme_advanced_buttons1' => 'syntaxhl',
<?php $this->widget('application.extensions.tinymce.ETinyMce', array('id'=>'postBody','name'=>'body','useSwitch'=>false, 'editorTemplate'=>'full','language' => 'zh', 'model' => $postText,'attribute'=>'body', 'options' => array('theme' => 'advanced','skin' => 'o2k7','skin_variant'=>'silver', 'theme_advanced_resize_horizontal'=>false,'plugins'=>'syntaxhl','remove_linebreaks'=>false, 'extended_valid_elements'=>'textarea[cols|rows|disabled|name|readonly|class]' , 'theme_advanced_buttons1' => 'preview,bold,italic,underline,fontselect,fontsizeselect,link,justifyleft,justifycenter,justifyright,table,image,|,bullist,numlist,|,undo,redo,|,code,syntaxhl,fullscreen', 'theme_advanced_buttons2' => '', 'theme_advanced_buttons3' => '', ))); ?>
Tinymce will add a new button at the end.
The Code highlighting function is completed in a few steps. Check this article. Of course, you can also expand the code copying function on your own.
From: It News Network
| Original address: http://www.itkuaixun.com/post/48.htm
More articles on "yii tinymce syntax highlighting"
Love J2EE follow Java Michael Jackson video station JSON online tools
Http://biancheng.dnbcw.info/php/332632.html pageno: 11.