CI2.0集成新浪在线编缉器(史上超简单超漂亮)
本帖最后由 gzwazz 于 2011-3-8 14:43 编辑首先上图看看
方法如下
Upp.php 此文件放在libraries下
<?phpif ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Upp {
public $BasePath;
public $Width;
public $Height;
public $eName;
public $Value;
public $AutoSave;
function SinaEditor($eName){
$this->eName=$eName;
$this->BasePath='.';
$this->AutoSave=false;
$this->Height=460;
$this->Width=630;
return $this;
}
function create(){
$ur=base_url();
$ReadCookie=$this->AutoSave?1:0;
return <<<eot
<textarea name="{$this->eName}" id="{$this->eName}" style="display:none;">{$this->Value}</textarea>
<iframe src="{$ur}/editweb/Edit/editor.htm?id={$this->eName}&ReadCookie={$ReadCookie}" frameBorder="0" marginHeight="0" marginWidth="0" scrolling="No" width="{$this->Width}" height="{$this->Height}"></iframe>
eot;
}
}
controllers控制器加载是这样的public function add(){
//加载ubb在线编缉器
$this->load->library('upp');
$editor=$this->upp->SinaEditor('content');
$editor->Value='';
$editor->BasePath='editweb';
$editor->Height=400;
$editor->Width=900;
$editor->AutoSave=false;
$data['ubb']=$editor->Create();
$this->load->view('admin/news_add', $data);
}
views写法这样的
<?php
extract($_POST);
extract($_GET);
unset($_POST,$_GET);
if(isset($act)){
$act=='subok' && die("提交的内容是:<br>".htmlspecialchars($gently_editor));
}
echo $ubb;
?>
最后上传新浪在线编缉器
解压后放在和主放口文件index.php同级目录
此编缉器的上传功能被我限制了请自动修改editweb\Edit\editor\upload.php
完成
觉得可以请加分 编辑器很多,还要看用在什么服务器环境中,在好的如果不兼容也是费的,还有样式不是问题,css会写什么编辑器都可以把外表改的一样,重点在它的功能和扩展 感谢分享. 不错,这个编辑器还是很美观大方的! 顶 啊很不错的编辑器 CI要是能自带一个基本的编辑器框架就好了
喜欢wordpress的编辑器,不过不太好弄 我也用这个编辑器
不过还没用到CI 上 一直在一个简单实用的编辑器
fck虽然强大,却过于累赘了.......这个不错 简洁美观,支持 我想把那个 插入链接 功能去掉 或者让他没起到作用如何做啊·····请各位大侠指点迷经 不错的编辑器