|
发表于 2009-4-7 12:46:19
|
显示全部楼层
我也献一小计,分享我的调用方法:
models下新建文件"o_editor.php"
内容为下:
---------------------------------------------------
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* @author yhui
*
*/
class O_editor extends Model
{
function O_editor()
{
parent::Model();
}
/**
* fckeditor
*
* @param $name: 名称
* @param $value: 初始内容
* @param $toolbar: Basic,Default
* @return object
*/
function fckeditor($name, $value='', $toolbar='Default')
{
$editer_dir = 'lib/fckeditor/'; //此处表示index.php同级目录下的lib文件夹下再有"fckeditor"文件夹,当然你也可以设置你自己喜欢的路径
include $editer_dir.'fckeditor.php'; //".php"不建议替换为“EXT”
$sBasePath = $editer_dir;
$oFCKeditor = new FCKeditor($name);
$oFCKeditor->BasePath = $editer_dir;
$oFCKeditor->ToolbarSet = $toolbar; //Basic,Default
$oFCKeditor->Value = $value;
$oFCKeditor->Height = 460;
$oFCKeditor->Width = "100%";
return $oFCKeditor;
}
}
?>
---------------------------------------------------
调用方法:
---------------------------------------------------
$this->load->model('o_editor');
$data['editor1'] = $this->o_editor->fckeditor('content1');
$data['editor2'] = $this->o_editor->fckeditor('content2');
$data['editor3'] = $this->o_editor->fckeditor('content3');
---------------------------------------------------
VIEW页:
---------------------------------------------------
$editor1->Height = 320;
echo $editor1->Create();
$editor2->Height = 320;
echo $editor2->Create();
$editor3->Height = 320;
echo $editor3->Create();
--------------------------------------------------- |
|