• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Integrating CKFinder / Load .html with view()

#1
Question 
Hi everybody,

I am trying ot integrate CKFInder in my app. Some questions will be directly CKFinder related, other will be broader, like the first one.

I stored the php connector in my server (as in the docs), but under \App\ThirdParty\ckfinder. Now I want to access teh sample sites, i.e. \App\ThirdParty\ckfinder\samples\ckeditor.html.

How do I do that? How do I route to a direct html file? I tried via closures, but it does not even parse:

PHP Code:
$routes->group('ckfinder', ['namespace' => 'App\ThirdParty\ckfinder\samples'], function($routes){
    $routes->get('full-page-open.html', function (){
        view('full-page-open.html');
    }); 
It is easier to search the internet than posting a question. So, yes, I am asking because I did not find the answer anywhere else.
Reply

#2
Hi there,

I am trying to show a .html File located under ThirdParty. I am also not able to show the file if it is under View using the view method.

I tried this:

PHP Code:
$routes->get('/ckfinder',function (){
            view(ROOTPATH'app/ThirdParty/ckfinder/samples/full-page-open.html');
        }); 
and I get the exception: Invalid file: /var/www/html/blog/app/ThirdParty/ckfinder/samples/full-page-open.html 

If I store it under Views and call:
PHP Code:
$routes->get('/ckfinder',function (){
            view('full-page-open.html');
        }); 
I get a blank page with the Toolbar
It is easier to search the internet than posting a question. So, yes, I am asking because I did not find the answer anywhere else.
Reply

#3
Please keep it to the same thread, it's the same issue. I have now merged your thread a second time.
Reply

#4
(05-05-2020, 11:19 AM)jreklund Wrote: Please keep it to the same thread, it's the same issue. I have now merged your thread a second time.
Aaah, ok. I thought I posted it to myself as an answer, that's why... My bad.
It is easier to search the internet than posting a question. So, yes, I am asking because I did not find the answer anywhere else.
Reply

#5
For anyone wondering, I made some progress:

new route in Config/Routes.php:
PHP Code:
$routes->group('ckfinder',function($routes) {
    $routes->get('''CKFinderController::index');
    $routes->get('/samples/(:any)''CKFinderController::index/$1');    
    $routes
->get('(:any)''CKFinderController::index/$1');    
}); 

New Controller in Config/Controllers:
PHP Code:
class CKFinderController extends BaseController{
    public function index($folder 'samples'$page 'full-page-open.html')
    {
        $view = \Config\Services::renderer();
        $namespace APPPATH.'ThirdParty/ckfinder/';
        return file_get_contents($namespace.$folder."/".$page);
    }

I am wondering if there is a better way than file_get_contents for returning a .html, .css, .js & co. files as is...

I also seem to have some trouble running JS. An intended messagebox appears, but no content...
It is easier to search the internet than posting a question. So, yes, I am asking because I did not find the answer anywhere else.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.