Javascript CKEditor TypeError:c[a]在CodeIgniter中未定义

Javascript CKEditor TypeError:c[a]在CodeIgniter中未定义,javascript,php,codeigniter,ckeditor,Javascript,Php,Codeigniter,Ckeditor,我正在尝试在基于codeigniter的网站上安装CKEditor,我遵循了本教程: 但是我收到这个错误:TypeError:c[a]未定义 CKEDITOR.lang.load/d() ckeditor___ckeditor:230 CKEDITOR.scriptLoader</<.load/f() ckeditor___ckeditor:231 CKEDITOR.scriptLoader</<.load/x()

我正在尝试在基于codeigniter的网站上安装CKEditor,我遵循了本教程:

但是我收到这个错误:
TypeError:c[a]未定义

CKEDITOR.lang.load/d()                   ckeditor___ckeditor:230
CKEDITOR.scriptLoader</<.load/f()        ckeditor___ckeditor:231
CKEDITOR.scriptLoader</<.load/x()        ckeditor___ckeditor:231
CKEDITOR.scriptLoader</<.load/A()        ckeditor___ckeditor:231
CKEDITOR.scriptLoader</<.load/u/g.$.onerror()
CKEDITOR.lang.load/d()CKEDITOR\uuuuu CKEDITOR:230
scriptLoader
在codeigniter中使用CKEDITOR
你需要
1.Ckeditor helper:Ckeditor_helper.php文件放在system/helpers文件夹中
2.Ckeditor-PACAKE:http://ckeditor.com/download 放在根目录上
在控制器文件ex.Page.php中编写以下代码
-------------------------------------------------------------------------
类页扩展CI_控制器{
公共数据;
公共函数uu构造(){
父项::_构造();
$this->load->helper('ckeditor');//加载helper
}
//加载html视图
公共函数add(){
$this->data['ckeditor']=数组(
'id'=>'format',//将被替换的文本区域的id'path'=>'../ckeditor/',
'配置'=>数组(
'toolbar'=>“Full”,//使用完整工具栏
“宽度”=>“自动”//自定义宽度
“高度”=>“300px”//自定义高度
),   
);    
//加载添加文件
$this->load->view('page/add',$this->data);
}    
}     
加载视图文件
--------------------------------------------------------------------- 
add.php
页面格式
添加
将js写入视图文件->
//ckeditor\u helper.php
//打开系统/助手/

我也有同样的问题。CKEditor未正确标识其自己的文件夹。 因此,在加载CKEDITOR之前,应该设置一个CKEDITOR_BASEPATH变量

这里简单地说了一下:(但在其他地方可能会有更好的解释。)

因此,实施过程如下:

<script>
  window.CKEDITOR_BASEPATH = 'http://example.com/path/to/libs/ckeditor/';
</script>

我还在我的CI项目中使用了Ckeditor。不要用这么长的路使用这些简单的步骤-

  • 导出路径assets/js/中的Ckeditor库,正如您已经完成的那样

  • 在您的html页面中包含此内容-
    在页面顶部

  • 在html之后,包含代码为-

    CKEDITOR.replace('content')

    /*content是要应用ckeditor的textarea字段的名称*/


  • 嘿,那个教程已经有好几年了——它是为codeigniter 1.7编写的,他们有一些关于codeigniter 2的注释。Codeigniter现在是版本3。关于在这个线程中包含ck基本代码的编辑器的讨论:这看起来也很有趣:您可以在头中包含Ckeditor库,也可以在项目中的任何地方使用。你可以检查我的以上答案。
      //ckeditor_helper.php  
     //put on system/helpers/   
    <?php   
    if(!defined('BASEPATH')) exit('No direct script access allowed');
    function form_ckeditor($data)
    {
        $data['language'] = isset($data['language']) ? $data['language'] : 'es';
    
        $size    = isset($data['width']) ? 'width: "'.$data['width'].'", ' : '';
        $size  .= isset($data['height']) ? 'height: "'.$data['height'].'", ' : '';
    
        $options = '{'.
                $size.
                'language: "'.$data['language'].'", 
    
                stylesCombo_stylesSet: "my_styles",
    
                startupOutlineBlocks: true,
                entities: false,
                entities_latin: false,
                entities_greek: false,
                forcePasteAsPlainText: false,
    
                filebrowserImageUploadUrl : "filexplorers/fckeditor_upload/image", // << My own file uploader
                filebrowserImageBrowseUrl : "filexplorers/inlinebrowse/image", // << My own file browser
                filebrowserImageWindowWidth : "80%",
                filebrowserImageWindowHeight : "80%",   
    
    
                toolbar :[
                    ["Source","-","FitWindow","ShowBlocks","-","Preview"],
                    ["Undo","Redo","-","Find","Replace","-","SelectAll","RemoveFormat"],
                    ["Cut","Copy","Paste","PasteText","PasteWord","-","Print","SpellCheck"],
                    ["Form","Checkbox","Radio","TextField","Textarea","Select","Button","ImageButton","HiddenField"],
                    ["About"],
    
                    "/",
    
                    ["Bold","Italic","Underline"],
                    ["OrderedList","UnorderedList","-","Blockquote","CreateDiv"],
    
                    ["Image","Flash","Table"],
    
                    ["Link","Unlink","Anchor"],
                    ["Rule","SpecialChar"],
                    ["Styles"]
                ]
            }';
    
    
        $my_styles = 'CKEDITOR.addStylesSet("my_styles",
            [
                // Block Styles
                { name : "H3", element : "h3"},
                { name : "Heading 4", element : "h4"},
                { name : "Heading 5", element : "h5"},
                { name : "Heading 6", element : "h6"},
                { name : "Document Block", element : "div"},
                { name : "Preformatted Text", element : "pre"},
                { name : "Address", element : "address"},
    
                // Inline Styles
                { name: "Centered paragraph", element: "p", attributes: { "class": "center" } },
    
                { name: "IMG bordered", element: "img", attributes: { "class": "bordered" } },
    
                { name: "IMG left", element: "img", attributes: { "class": "left" } },
                { name: "IMG right", element: "img", attributes: { "class": "right" } },
    
                { name: "IMG left bordered", element: "img", attributes: { "class": "left bordered" } },
                { name: "IMGright bordered", element: "img", attributes: { "class": "right bordered" } },
            ]);';
    
        return 
        // fix: move to <HEAD...
        '< script type="text/javascript" src="'.base_url().'application/plugins/ckeditor/ckeditor.js"></ script>' .
    
        // put the CKEditor
         '< script type="text/javascript">' .
                $my_styles .
                'CKEDITOR.replace("'.$data['id'].'", ' . $options . ');</ script>';
    }
    
    <script>
      window.CKEDITOR_BASEPATH = 'http://example.com/path/to/libs/ckeditor/';
    </script>
    
    <script type="application/javascript"/>
    $(document).ready(function (){
        CKEDITOR.replace( 'product_content' );  // ID of element
    });
    </script>