[eluser]dezafu[/eluser]
first copy CKEditor folder to your web root
simply just add javascript for CKEditor
Code: //For PHP
<?=script('ckeditor/ckeditor.js');?>
<?=script('ckeditor/adapters/jquery.js');?>
//For Javasctipt
$(function()
{
var configFull = {
toolbar:
[
['Source','-','Save','NewPage','Preview','-','Templates'],
['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'],
'/',
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
['Link','Unlink','Anchor'],
['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],
'/',
['Styles','Format','Font','FontSize'],
['TextColor','BGColor'],
['Maximize', 'ShowBlocks','-','About']
],
filebrowserBrowseUrl : '<?=base_url()?>index.php/ajax/browse',
filebrowserUploadUrl : '<?=base_url()?>index.php/ajax/upload',
filebrowserImageBrowseUrl : '<?=base_url()?>index.php/ajax/imageBrowse',
filebrowserFlashBrowseUrl : '<?=base_url()?>index.php/ajax/flashBrowse',
filebrowserImageUploadUrl : '<?=base_url()?>index.php/ajax/imageUpload',
filebrowserFlashUploadUrl : '<?=base_url()?>index.php/ajax/flashUpload',
};
var configBasic = {
toolbar:
[
['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink']
]
}
// Initialize the editor.
// Callback function can be passed and executed after full instance creation.
$('body')
.find('textarea.ckfull')
.ckeditor(configFull)
.end()
.find('textarea.ckbasic')
.ckeditor(configBasic);
});
[eluser]basty_dread[/eluser]
Hi there i need a simple image upload/ flash upload sample
because i dont know how it could get uploaded
just simple upload for the image and flash
using ckeditor.
Thanks
[eluser]Unknown[/eluser]
[quote author="Nicolas Rios" date="1269394169"]check the Wiki:
http://codeigniter.com/wiki/CKEditor/
I put how to install and config with FCK 3.2 .
Regards,[/quote]
Can you also show how to integrate ckfinder in it?
Thanks.
[eluser]Carlos Alcala[/eluser]
The post is very nice and works like a charm, BUT can you also explain how to set up the CKFinder integration with CKEditor?
Thanks,
Carlos
[eluser]riza_nurhadi[/eluser]
[quote author="basty_dread" date="1266942722"]Hi there i need a simple image upload/ flash upload sample
because i dont know how it could get uploaded
just simple upload for the image and flash
using ckeditor.
Thanks[/quote]
first off all i downloaded the ckeditor then exctract it all into folder static.
thats just because i dont know which file that ckeditor will use.
this is my only image upload.
i don't use the filebrowser plugin.
VIEW
Code: <_script type="text/javascript" src="<?php echo base_url() . "/static/ckeditor/ckeditor.js" ?>">[removed]
<?php print form_textarea('keterangan','','id="keterangan" class="textarea"')?>
CKEDITOR.replace( 'keterangan',
{
fullPage : true,
filebrowserUploadUrl : '<?php echo base_url() . index_page() ?>/drainase/upload_saluran_ckeditor/',
filebrowserImageUploadUrl : '<?php echo base_url() . index_page() ?>/drainase/upload_saluran_ckeditor/keterangan/1/en'
});
<_/script>
CONTROLLER
Code: class Drainase extends Controller {
function Drainase()
{
}
function index()
{
}
function upload_saluran_ckeditor(){
$upload_gambar = $this->common->upload_image_file('upload');
if(isset($upload_gambar['data']['upload_data']['file_name']) && trim($upload_gambar['data']['upload_data']['file_name']) != '') {
$funcNum = $this->uri->segment('4');
$CKEditor = $this->uri->segment('3');
$langCode =$this->uri->segment('5');
// Check the $_FILES array and save the file. Assign the correct path to some variable ($url).
$url = base_url() . '/file/images/' . $upload_gambar['data']['upload_data']['file_name'];
// Usually you will assign here something only if file could not be uploaded.
$message = '';
echo "<_script type='text/javascript'>window.parent.CKEDITOR.tools.callFunction($funcNum, '$url', '$message');<_/script>";
} else {
echo $upload_gambar['message']['error'];
}
}
}
UPLOAD IMAGE FUNCTION [its just basic codeigniter upload file]
Code: function upload_image_file($fieldnames) {
$image_path = "" . BASE_FILE_IMAGE_PATH;
$config['upload_path'] = $image_path;
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '300';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
$result['sukses'] = 0;
$result['message'] = 'gagal' ;
$result['data'] = array();
if ( ! $this->upload->do_upload($fieldnames))
{
$error = array('error' => $this->upload->display_errors());
$result['message'] = $error ;
}
else
{
$data = array('upload_data' => $this->upload->data());
$result['sukses'] = 1;
$result['message'] = 'Upload Sukses' ;
$result['data'] = $data;
}
return $result;
}
if you wanna read a full documentation. go to this link
http://docs.cksource.com/CKEditor_3.x/De...le_Browser
[eluser]polianych[/eluser]
I have problems with window.parent.CKEDITOR.tools.callFunction(1, $url)
Argument "1" didn`t want to work. This is how i solved problem, mybe it will be useful for somebody.
Code: parse_str($_SERVER['QUERY_STRING'], $_GET);
$ckefunc = $_GET['CKEditorFuncNum'];
$output = "<html><body>< script type='text/javascript'>window.parent.CKEDITOR.tools.callFunction($ckefunc, '$url');< /script></body></html>";
echo $output;
|