|
PHP复制代码 <?php if( !defined('BASEPATH') ) exit('Sorry! No Direct Script Access Allowed.');
class Kindeditor {
private $CI;
private $date = array();
/**
* 获得CI的句柄
*/
public function __construct (){
$this->CI =& get_instance ();
$this->date = array( 'default'=>base_url ().'myeditor/themes/default/default.css',
'plugins'=>base_url ().'myeditor/plugins/code/prettify.css',
'editor'=>base_url ().'myeditor/kindeditor.js',
'lang'=>base_url ().'myeditor/lang/zh_CN.js',
'pret'=>base_url ().'myeditor/plugins/code/prettify.js' );
}
/**
* 显示页面
*/
public function showlink (){
$this->CI->smarty->assign( 'css1', $this->load_css($this->date['default']) );
$this->CI->smarty->assign( 'css2', $this->load_css($this->date['plugins']) );
$this->CI->smarty->assign( 'js1', $this->load_js($this->date['editor']) );
$this->CI->smarty->assign( 'js2', $this->load_js($this->date['lang']) );
$this->CI->smarty->assign( 'js3', $this->load_js($this->date['pret']) );
}
/**
* 载入JS
*/
private function load_js ($path){
return '<script type="text/javascript" charset="utf-8" src="'.$path.'"></script>';
}
/**
* 载入CSS
*/
private function load_css ($path){
return '<link href="'.$path.'" rel="stylesheet" type="text/css" />';
}
} 复制代码
使用的时候在<head>和</head>之间加入<{$css1|default:""}><{$css2|default:""}><{$js1|default:""}><{$js2|default:""}><{$js3|default:""}>
请问这样做好吗?新手,欢迎拍砖
|
|