1. Modify the Kdeditor.php file in the YIi extension directory and put the js object declaration outside the method.
$js=<<
var editor_$this->id;
KindEditor.ready(function(K) {
editor_$this->id = K.create('#$this->id',
$properties_string
);
});
F;
2. View file code
[html]
Template variable:
[html]
3. Model file, post-processing
[html]
/**
* Get template variables
*/
public function getVarUbb($type=null){
if($type==null){
return array(
'{username}'=>'{username}',
'{url}'=>'{url}',
'{sitename}'=>'{sitename}',
);
}
}
/**
* Template variable replacement
*/
public function replaceVarUbb($str){
$str = str_replace('{username}','',$str);
$str = str_replace('{url}','',$str);
$str = str_replace('{sitename}','name; ?>',$str);
return $str;
}
/**
* Operations after saving the template
* Write template file
*/
protected function afterSave(){
$templatePath = Yii::app()->mailer->pathViews;
$templatePath = str_replace('application','',$templatePath);
$templatePath = str_replace('.','/',$templatePath);
$templatePath = Yii::app()->basePath.$templatePath.'/';
$templatePath = $templatePath.$this->zee_filename.'.php';
$handle = fopen($templatePath, "wb");
fwrite($handle, $this->replaceVarUbb($this->zee_content));
fclose($handle);
}
4. Rendering
http://www.bkjia.com/PHPjc/477650.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477650.htmlTechArticle1. Modify the Kdeditor.php file in the YIi extension directory and put the js object declaration outside the method [ html] $js=EOF var editor_$this-id; KindEditor.ready(function(K) { editor_$this-id = K.c...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn