简体   繁体   English

如何在CodeIgniter中集成CKFinder和CKEditor?

[英]How to integrate CKFinder with CKEditor in CodeIgniter?

I have researched this and I have found many ways of integrating CKEditor but I'm having trouble integrating CKFinder. 我研究了这个,我发现了许多集成CKEditor的方法,但是我在整合CKFinder时遇到了麻烦。 My website was created by someone else but I feel I can integrate this myself. 我的网站是由其他人创建的,但我觉得我可以自己整合。

The website contains articles and I have a 'view' that uses CKEditor. 该网站包含文章,我有一个使用CKEditor的“视图”。 It works great but I cannot upload images to the server or browse the server images to insert photos within CKEditor. 它工作得很好但我无法将图像上传到服务器或浏览服务器图像以在CKEditor中插入照片。 So I can't add photos within the article text. 所以我无法在文章文本中添加照片。 I'm hoping CKFinder will solve that issue. 我希望CKFinder能解决这个问题。

I have uploaded the CKFinder files and put them in the same location as the CKEditor. 我已经上传了CKFinder文件并将它们放在与CKEditor相同的位置。 In my addcontent.php I have the CKEditor code declared in the header. 在我的addcontent.php中,我在头文件中声明了CKEditor代码。

    <script src="<?php echo base_url(); ?>plugins/ckeditor/ckeditor.js"></script>

This is the ckeditor textarea: 这是ckeditor textarea:

    <div class="form-group">
                  <label>Content Text</label>
                  <textarea class="form-control" id="description" name="text" rows="3"></textarea><div id="des_error" class="text-danger"></div>
                </div>

And this is the ckeditor function: 这是ckeditor功能:

        <script type="text/javascript">
  $(function () {
    // Replace the <textarea id="editor1"> with a CKEditor
    // instance, using default configuration.
    CKEDITOR.replace('description');
    //bootstrap WYSIHTML5 - text editor
    $(".textarea").wysihtml5();

If I declare the ckfinder in the header like this: 如果我在标题中声明ckfinder如下:

    <script src="<?php echo site_url(); ?>plugins/ckfinder/ckfinder.js"></script>

How do I amend the code to allow the CKFfinder to work with the CKEditor so I can browse and upload files within the article text? 如何修改代码以允许CKFfinder与CKEditor一起使用,以便我可以在文章文本中浏览和上传文件?

As a side note I do not see the CKEditor defined in any of the controllers. 作为旁注,我没有看到任何控制器中定义的CKEditor。

You can use responsivefilemanager : https://www.responsivefilemanager.com/#download-section 您可以使用responsivefilemanager: https//www.responsivefilemanager.com/#download-section

 <script> CKEDITOR.replace('description', { filebrowserBrowseUrl: '<?php echo base_url();?>filemanager/dialog.php?type=2&editor=ckeditor&fldr=', filebrowserUploadUrl: '<?php echo base_url();?>filemanager/dialog.php?type=2&editor=ckeditor&fldr=', filebrowserImageBrowseUrl: '<?php echo base_url();?>filemanager/dialog.php?type=1&editor=ckeditor&fldr=' }); </script> 

You should change configration file at filemanager\\config\\config.php 您应该在filemanager \\ config \\ config.php中更改配置文件

upload_dir' => '/uploadfilemanager/source/', //Upload folder

'thumbs_base_path' => '../thumbs/', //Thumbnail folder 

'current_path' => '../source/', // The current path that you're using CKEditor

CKEditor and File Manager CKEditor和文件管理器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM