How to define a dynamic folder in Ckfinder?

Asked

Viewed 170 times

1

I’m cracking my head to set a dynamic folder when opening a popup from Ckfinder. Look at the code below:

// config.js
var finder  = new CKFinder();
finder.popup();

// CONFIG.PHP
$baseDir = __DIR__.'/../../biblioteca/';
$baseUrl = '';

I want you to enter a specific folder when you click a button, the folder that is in the button ID. But I couldn’t do it. I think this configuration is interfering with the Config.PHP Ckfinder. However, if I touch this file, it doesn’t work either.

1 answer

3


The popup() method accepts basePath as the first parameter. It has the following signature:

<static> {CKFinderAPI} CKFinder.popup(basePath, width, height, selectActionFunction, callback)

So, in the button click events, you should call the popup as follows:

finder.popup( $(this).attr('id') );
  • I tried it this way. But it just opens the POPUP at the root. I don’t know if it’s possible I’m missing the directory. I’m using up a baseURL to not have problems.

  • Try the following changes: 1) on each button, create the data-href="path/of/directory/this/button" 2) in the onClick button event make Finder.popup( $(this).data('href') ).

  • When leaving Finder.popup directly in config.js, I imagine you are calling it whenever the file runs. This is what is happening?

  • So, @marquesini, I even put the direct absolute path as a parameter in Ckfinder.popup(). But it still doesn’t redirect to the folder I specified. Also, the Ckfinder screen maximizes when I do this. My Ckfinder opens in an Onclick button event.

  • There is also the possibility to use the method {Undefined} openFolder(resourceType, path), as in the example: Finder.openFolder( 'Images', '/' ).

  • There’s an example of how to do it ? It’s in the Ckfinder documentation ?

  • Diego, you are in the document yes: http://docs.cksource.com/ckfinder_2.x_api/ Check out the namespace Ckfinder and Ckfinderapi methods.

  • I took a look, tried it several ways and it didn’t work. But it’s not that urgent. Anyway, thanks.

Show 3 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.