Jump to content

loading CKFinder 2.x with jQuery


micah1701

Recommended Posts

With 1.x versions of CKFinder, I've had great success implementing the file browsing application by simply doing something like:

<button id="saveImage">Browse...</button>
<script type="javascript">
$(document).ready(function() {

$('#saveImage').click(function() {
		CKFinder.Popup( { BasePath : '/ckfinder/', 
						  SelectFunction : setImageFilePath,  
						  startupFolderExpanded: true
						});
		return false;
});	

});
</script>

 

But swapping out version 1.4 for 2.0, this doesn't work and I get the error "CKFinder.Popup is not a function."

If I call CKFinder without jQuery using the standard code it works, so I know its there.  And its finding the CKFinder object.

alert(CKFinder.version);

this returns "2.0.4" so I just don't get what I'm missing or doing wrong.

 

And, I know I have jQuery working because I'm using it elsewhere in my app.  In fact, when I do this

<textarea name="editor" id="editor">wysiwyg</textarea>
    <script type="text/javascript">
    $('#editor')
        .ckeditor(function()     { CKFinder.SetupCKEditor(this,'/ckfinder/'); 
                
                                }, 
                                { skin : 'office2003' }
                     )};
    </script>

it loads CKEditor, just without CKFinder (and gives the error "CKFinder.SetupCKEditor is not a function")

 

Any ideas on what I'm missing or doing wrong?  :shrug:

This has been driving me nuts all week and I've had very little luck with the documentation or searching other forums.

Link to comment
https://forums.phpfreaks.com/topic/215424-loading-ckfinder-2x-with-jquery/
Share on other sites

  • 1 month later...

:o I can't believe it was that simple.  All the documentation (which I'm guessing is for version 1.x) shows it with a capital 'S' -- and its always worked that way in the old version.  I can't believe it was so hard for me to find the answer to my problem, you'd think other people would have the same issue.  :shrug:

 

There was another place I was having trouble using CKFinder, without CKeditor, but based on this new knowledge, I changed:

CKFinder.Popup( { BasePath : '/ckfinder/' });

to

CKFinder.popup( { BasePath : '/ckfinder/' });

 

and what'dya know it works!

 

:D THANK YOU SO MUCH!!!  :D

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.