Welcome Guest, Not a member yet? Register   Sign In
CKeditor with upload
#8

(This post was last modified: 05-08-2016, 05:08 AM by InsiteFX.)

This is kind of long, but you will get the idea.

NOTE: If you get a 404 File Not Found then 10 to 1 it is the javascript paths.

Setup for assets

[Image: assets.png]

At the bottom of you view add this code:

Code:
<!-- ckeditor.js, load it only in the page you would like to use CKEditor -->
<script src="<?php echo asset('ckeditor/ckeditor.js');?>"></script>

<!-- This is used in controllers/admin/Dashboard.php
       If used just under controllers then remove the ../
-->
<!-- add responsive filemanager to ckeditor. -->
<script>
    CKEDITOR.replace('textarea-ckeditor',{
        filebrowserBrowseUrl : '../assets/filemanager/dialog.php?type=2&editor=ckeditor&fldr=',
        filebrowserUploadUrl : '../assets/filemanager/dialog.php?type=2&editor=ckeditor&fldr=',
        filebrowserImageBrowseUrl : '../assets/filemanager/dialog.php?type=1&editor=ckeditor&fldr='
    });
</script>

The form take note of the form id and name:

PHP Code:
<!-- Textareas and Editor Content -->
<
form action="page_forms_components.html" method="post" class="form-horizontal" onsubmit="return false;">
 
  
   
<!-- CKEditoryou just need to include the plugin (see at the bottom of this page) and add the class 'ckeditor' to your textarea -->
 
  <!-- More info can be found at http://ckeditor.com -->
 
  <div class="form-group">
 
     <!--<label class="control-label" for="textarea-ckeditor">CKEditor</label>-->
 
     <div class="col-md-12">
 
        <textarea id="textarea-ckeditor" name="textarea-ckeditor" class="ckeditor"></textarea>
 
     </div>
 
  </div>

</
form>
<!-- 
END Textareas and Editor Content --> 

Filemanager assets/filemanager/config/config.php

PHP Code:
/*
    |--------------------------------------------------------------------------
    | path from base_url to base of upload folder
    |--------------------------------------------------------------------------
    |
    | with start and final /
    | I point this to my images folder because thats all that will be uploaded.
                  | You can change this if you want to.
    */
    
'upload_dir' => '/assets/images/',

    
/*
    |--------------------------------------------------------------------------
    | relative path from filemanager folder to upload folder
    |--------------------------------------------------------------------------
    |
    | with final /
    |
    */
    
'current_path' => '../images/',

    
/*
    |--------------------------------------------------------------------------
    | relative path from filemanager folder to thumbs folder
    |--------------------------------------------------------------------------
    |
    | with final /
    | DO NOT put inside upload folder
    |
    */
    
'thumbs_base_path' => '../images/thumbs/'

That will get you up and running using the filemanager with CKEditor.

The rest will be up to you to configure, there is not enough room to add everything here...

asset_helper can be found here: asset_helper
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
CKeditor with upload - by ChicagoPhil - 05-06-2016, 12:16 AM
RE: CKeditor with upload - by PaulD - 05-06-2016, 08:51 AM
RE: CKeditor with upload - by ivantcholakov - 05-06-2016, 09:53 AM
RE: CKeditor with upload - by cartalot - 05-06-2016, 12:20 PM
RE: CKeditor with upload - by InsiteFX - 05-06-2016, 01:20 PM
RE: CKeditor with upload - by ChicagoPhil - 05-07-2016, 09:16 PM
RE: CKeditor with upload - by Wouter60 - 05-08-2016, 04:13 AM
RE: CKeditor with upload - by InsiteFX - 05-08-2016, 04:48 AM
RE: CKeditor with upload - by Wouter60 - 05-08-2016, 05:21 AM



Theme © iAndrew 2016 - Forum software by © MyBB