gzwazz 发表于 2011-3-8 14:37:48

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
完成
觉得可以请加分

yifei8155 发表于 2015-7-28 16:26:39

编辑器很多,还要看用在什么服务器环境中,在好的如果不兼容也是费的,还有样式不是问题,css会写什么编辑器都可以把外表改的一样,重点在它的功能和扩展

deloz.net 发表于 2011-3-8 15:31:03

感谢分享.

mageguoshi 发表于 2011-3-8 17:39:41

不错,这个编辑器还是很美观大方的!

hellblog 发表于 2011-3-8 20:37:56

顶 啊很不错的编辑器

skeay 发表于 2011-3-8 20:43:09

CI要是能自带一个基本的编辑器框架就好了
喜欢wordpress的编辑器,不过不太好弄

hmily36 发表于 2011-3-9 12:54:41

我也用这个编辑器
不过还没用到CI 上

zhouli520 发表于 2011-3-10 00:26:41

一直在一个简单实用的编辑器
fck虽然强大,却过于累赘了.......这个不错

davidx 发表于 2011-3-10 14:34:36

简洁美观,支持

qinshu123 发表于 2011-3-11 09:25:52

我想把那个 插入链接 功能去掉 或者让他没起到作用如何做啊·····请各位大侠指点迷经

thfei1982 发表于 2011-3-11 09:51:43

不错的编辑器
页: [1] 2 3 4 5 6 7
查看完整版本: CI2.0集成新浪在线编缉器(史上超简单超漂亮)