1.修改YIi扩展目录下的Kdeditor.php 文件,把中的js对象声明放到方法外面
[html]
$js=
var editor_$this->id;
KindEditor.ready(function(K) {
editor_$this->id = K.create('#$this->id',
$properties_string
);
});
F;
2.视图文件代码
[html]
$val){?>
[html]
$('.template_var').bind('click',function(){
var str = $(this).attr('val');
editor_EmailTemplates_zee_content.insertHtml(str);//editor_EmailTemplates_zee_content js编辑器对象名称
});
3.模型文件,后期处理
[html]
/**
* 获取模板变量
*/
public function getVarUbb($type=null){
if($type==null){
return array(
'{username}'=>'{username}',
'{url}'=>'{url}',
'{sitename}'=>'{sitename}',
);
}
}
/**
* 模板变量替换
*/
public function replaceVarUbb($str){
$str = str_replace('{username}','',$str);
$str = str_replace('{url}','',$str);
$str = str_replace('{sitename}','name; ?>',$str);
return $str;
}
/**
* 模板保存后的操作
* 写入模板文件
*/
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.效果图

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

Eclipse용 SAP NetWeaver 서버 어댑터
Eclipse를 SAP NetWeaver 애플리케이션 서버와 통합합니다.

Atom Editor Mac 버전 다운로드
가장 인기 있는 오픈 소스 편집기

ZendStudio 13.5.1 맥
강력한 PHP 통합 개발 환경

VSCode Windows 64비트 다운로드
Microsoft에서 출시한 강력한 무료 IDE 편집기

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경
